从“第二行”的 json 抓取数据

Scraping data from json which is in "2nd line"

晚上好,

我想刮睾丸。我尝试了什么,但没有用。我做错了什么?

Json = json.loads(info.content)
aba = Json['checkout']['line_items'].get("testid")
infocontent = 
{
   "checkout":{
      "completed_at":null,
      "created_at":"2020-02-27T17:43:50+01:00",
      "line_items":[
         {
            "id":"538af6bda25ea2ba30811ca527631cc6",
            "key":"538af6bda25ea2ba30811ca527631cc6",
            "auth":4462126596176,
            "testid":31830643277904,
          }]
}

line_items 的值是一个对象列表,尽管列表中只有一个对象。您需要先获取列表中的第一项,然后才能对它使用 get

aba = Json['checkout']['line_items'][0].get("testid")