coldfusionlucee

Coldfusion Lucee - How to output fields of JSON cfhttp return?


I am making a cfhttp call to a service to get details related to service requests. I want to be able to output or store certain values that are coming back in the DB.

There is a main struct returned called member with most of the fields on that, but there are also sub structs called classtructure (for example) with a subset of fields and data I would need. See the attached images for more info.

When the data comes back here is how I am showing it currently.

<cfset content = #result.Filecontent#> 
<cfset data = #DeserializeJSON(content)#> 
<cfdump var="#data#">

When I try to say #data.description# it says that it doesn't exist. How do I reference the values and sub struct values to output them on the page?

example 1

example 2


Solution

  • I figured it out. I wasn't referencing the object as arrays. This allows me to get to an individual field.

    <cfdump var="#apikeyname.member[1].classstructure[1].description#">