Did you notice responseheader at the beginning of your json result? data = deserializeJSON(results).responseheader;
writeDump(data.EXPLANATION); writeDump(data.STATUS_CODE); I prefer openbd's script version of cfhttp. <cfscript> httpResult = HTTP( method : "get", url : 'http://some/url' ); jsondata = deserializeJSON(httpResult).responseheader; writeDump(jsondata.EXPLANATION); writeDump(jsondata.STATUS_CODE); </cfscript> On Wednesday, July 8, 2015 at 1:37:28 PM UTC-5, Jason Allen wrote: > > Trying to parse JSON response from Google's SafeSearchAPI. > > I use cfhttp to make the call, and I get proper JSON results. > > Out of the entire block of code, all I want to pull from it is the > 'EXPLANATION' and 'STATUS_CODE' results. > > The cfhttp puts the results in the var 'results' > > If I cfdump 'results' I get the following json > > {"responseheader":{"Content-Type":"application/octet-stream","P3P":"CP=\"This > is not a P3P policy! See > http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 > for more info.\"","X-Content-Type-Options":"nosniff","Date":"Wed, 08 Jul > 2015 18:32:52 GMT","Server":"HTTP server > (unknown)","Content-Length":"0","X-XSS-Protection":"1; > mode=block","X-Frame-Options":"SAMEORIGIN","Set-Cookie":{"1":"PREF=ID=1111111111111111:TM=1436380372:LM=1436380372:V=1:S=Lu7fjZG7ovro3npA; > > expires=Fri, 07-Jul-2017 18:32:52 GMT; path=/; > domain=.google.com","2":"NID=69=bCiizwBbSkIzNylFuqGio0zxL_8b8tpCotM-ve9-7Ye8fnOo_AVqmAT4em7jcbaY5cI8KY9WZB7G89RuBVS7IObffod2fyO11m17pjZNQTJElvNlgHpb7czyuBTgwYsg; > > expires=Thu, 07-Jan-2016 18:32:52 GMT; path=/; domain=.google.com; > HttpOnly"},"Alternate-Protocol":"443:quic,p=1","Connection":"close","HTTP_VERSION":"HTTP/1.1","EXPLANATION":"No > > Content","STATUS_CODE":204},"header":"HTTP/1.1 204 No Content Content-Type: > application/octet-streamP3P: CP=\"This is not a P3P policy! See > http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 > for more info.\"X-Content-Type-Options: nosniffDate: Wed, 08 Jul 2015 > 18:32:52 GMTServer: HTTP server (unknown)Content-Length: 0X-XSS-Protection: > 1; mode=blockX-Frame-Options: SAMEORIGINSet-Cookie: > PREF=ID=1111111111111111:TM=1436380372:LM=1436380372:V=1:S=Lu7fjZG7ovro3npA; > expires=Fri, 07-Jul-2017 18:32:52 GMT; path=/; > domain=.google.comSet-Cookie: > NID=69=bCiizwBbSkIzNylFuqGio0zxL_8b8tpCotM-ve9-7Ye8fnOo_AVqmAT4em7jcbaY5cI8KY9WZB7G89RuBVS7IObffod2fyO11m17pjZNQTJElvNlgHpb7czyuBTgwYsg; > > expires=Thu, 07-Jan-2016 18:32:52 GMT; path=/; domain=.google.com; > HttpOnlyAlternate-Protocol: 443:quic,p=1Connection: > close","mimetype":"application/octet-stream","charset":"","filecontent":"","statuscode":"204 > > No Content","errordetail":"","text":true} > > I have tried 'deserialize(results)' but that returns to me and empty value > "" > > Advice? > -- -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en --- You received this message because you are subscribed to the Google Groups "Open BlueDragon" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
