I'm working with a web API, which is returning the following data (this is a cfdump of the cfhttp.filecontent);
{"id":"xxx","service1":["xxx"],"service2":["xxx"]}
I need to be able to read this and determine if a service is on the list. For example,
<cfscript>
pdata = deserializeJSON(cfhttp.FileContent);
</cfscript>
<cfif IsDefined(pdata.service1)>Do something</cfif>
However, I'm receiving an error with the above code. I've only recently started working with JSON, and so far I've had reasonable success - but I'm stuck with this!
Any pointers much appreciated!
<cfif StructKeyExists(pdata, "service1")>...</cfif>