开发者

How on earth do I go about getting a single value out of this huge JSON object?

开发者 https://www.devze.com 2023-01-07 05:54 出处:网络
All i need to get is the jpg file \"url\" value in the results chunk. JSON is quite new to me... { \"ok\":\"ASSEMBLY_COMPLETED\",

All i need to get is the jpg file "url" value in the results chunk. JSON is quite new to me...

{
   "ok":"ASSEMBLY_COMPLETED",
   "message":"The assembly was successfully completed.",
 开发者_StackOverflow  "assembly_id":"99b0303243fd4a2f5da38111677aca71",
   "assembly_url":"http://api2.vivian.transloadit.com/assemblies/99b0303243fd4a2f5da38111677aca71",
   "bytes_received":1478560,
   "bytes_expected":1478560,
   "client_agent":"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16",
   "client_ip":"78.105.12.58",
   "client_referer":"http://gft.me/upload/",
   "start_date":"2010/07/13 23:29:31 GMT",
   "upload_duration":12.732,
   "execution_duration":0.688,
   "fields":{

   },
   "uploads":[
      {
         "id":"9543020bcb0785b4b867b0cbb057edec",
         "name":"2560x1600.jpg",
         "ext":"jpg",
         "size":1478068,
         "mime":"image/jpeg",
         "type":"image",
         "field":"my_file",
         "url":"http://tmp.vivian.transloadit.com/upload/ed29aaebcbbfe71cbaf885da12b244a4.jpg",
         "meta":{
            "width":2560,
            "height":1600,
            "date_recorded":null,
            "date_file_created":null,
            "date_file_modified":"2010/07/13 23:29:44 GMT",
            "title":null,
            "description":null,
            "location":null,
            "city":null,
            "state":null,
            "country":null,
            "country_code":null,
            "keywords":null,
            "aperture":null,
            "exposure_compensation":null,
            "exposure_mode":null,
            "exposure_time":null,
            "flash":null,
            "focal_length":null,
            "f_number":null,
            "iso":null,
            "light_value":null,
            "metering_mode":null,
            "shutter_speed":null,
            "white_balance":null,
            "device_name":null,
            "device_vendor":null,
            "device_software":null,
            "latitude":null,
            "longitude":null
         }
      }
   ],
   "results":{
      ":original":[
         {
            "id":"9543020bcb0785b4b867b0cbb057edec",
            "name":"2560x1600.jpg",
            "ext":"jpg",
            "size":1478068,
            "mime":"image/jpeg",
            "type":"image",
            "field":"my_file",
            "url":"http://media.thewildtimes.com.s3.amazonaws.com/95/43020bcb0785b4b867b0cbb057edec/2560x1600.jpg",
            "meta":{
               "width":2560,
               "height":1600,
               "date_recorded":null,
               "date_file_created":null,
               "date_file_modified":"2010/07/13 23:29:44 GMT",
               "title":null,
               "description":null,
               "location":null,
               "city":null,
               "state":null,
               "country":null,
               "country_code":null,
               "keywords":null,
               "aperture":null,
               "exposure_compensation":null,
               "exposure_mode":null,
               "exposure_time":null,
               "flash":null,
               "focal_length":null,
               "f_number":null,
               "iso":null,
               "light_value":null,
               "metering_mode":null,
               "shutter_speed":null,
               "white_balance":null,
               "device_name":null,
               "device_vendor":null,
               "device_software":null,
               "latitude":null,
               "longitude":null
            }
         }
      ]
   }
}


<variable>.results[":original"][0].url

If the colon in front of 'original' was an accident, then just do:

<variable>.results.original[0].url

0

精彩评论

暂无评论...
验证码 换一张
取 消