title: Parsing nested json payload python
body: <p>I am trying to get only value A from from this nested json payload.</p>
  
  <p><strong>My function:</strong></p>
  
  <pre><code>import requests
  import json
  def payloaded():
  from urllib.request import urlopen
  with urlopen("www.example.com/payload.json") as r:
      data = json.loads(r.read().decode(r.headers.get_content_charset("utf-8")))
  text = (data["bod"]["id"])
  print(text)
  </code></pre>
  
  <p><strong>The payload:</strong></p>
  
  <pre><code>bod: {
  id: [
      {
          value: "A",
          summary: "B",
          format: "C"
      }
    ]
  },
  </code></pre>
  
  <p>Currently it is returning everything within the brackets [... value ... summary ... format ...]</p>
  
  <p><strong>Solution found:</strong></p>
  
  <pre><code>def payloaded():
  from urllib.request import urlopen
  with urlopen("www.example.com/payload.json") as r:
      data = json.loads(r.read().decode(r.headers.get_content_charset("utf-8")))
  text = (data["bod"]["id"][0]["value"])
  print(text)
  </code></pre>