title: How can I pass json to a python script via command line?
body: <p>I'd like to pass a simple set of name/value pairs to a python script via json on the command line.</p>
  
  <pre><code>$ curl -s https://jsonplaceholder.typicode.com/posts/1 | python3.6 -c 'import sys, json; print json.load(sys.stdin)'
    File "&lt;string&gt;", line 1
      import sys, json; print json.load(sys.stdin)
                                 ^
  SyntaxError: invalid syntax
  (23) Failed writing body
  </code></pre>
  
  <p>The json is simple:</p>
  
  <pre><code>{
      "userId": 1,
      "id": 1,
      "title": "sunt aut facere repellat",
      "body": "quia et suscipit\nsuscipit..."
  }
  </code></pre>
  
  <p>And the goal is to assign variables like:</p>
  
  <pre><code>if json.load(sys.stdin)["title"] is not None:
      post_title = json.load(sys.stdin)["title"]
  </code></pre>
  
  <p>How can I accomplish this correctly?</p>