How to access XML fields from cfhttp

See the attached image. I am looking to get a list of the individual fields in the rdfs member array. So I can output each one separately. How do I reference the array/fields directly? If I try something like #myarray[1] it errors out saying key member does not exist.

Here is what I have so far:


cfhttp( url="site.url", username="uname", password="password", authType ="basic", result="dataresult", method="get" ) {
	cfhttpparam( name="select", type="url", value="*" );


  // Parse the JSON response into an array of structs
  myArray = deserializeJSON(dataresult.filecontent);


@spacerobot In your response array of structure, the struct key have an colon (rdfs:member). So, using the dot notation will throw error. So you have to bracket notation to get the result like in trycf example.

Thanks! When I try to run that on my cfhttp result I get an error key[1] does not exist. Any ideas?

I figured it out. Just need to take the [1] array reference off the master array like this:

 writeDump(var=myArray["rdfs:member"][2]["spi:name"] );

Thanks for your help!

1 Like