2

I am trying to parse through a cfhttp.filecontent that is returned and evaluate each variable.

Here is an example of what is being returned:

{"multicast_id":6110507831830919692,
 "success":0,
 "failure":1,
 "canonical_ids":0,
 "results":[{"error":"NotRegistered"}]}

So I would like to set to a list and loop through it so I can get the following:

multicast_id VARCHAR
success BIT
failure BIT
canonical_ids BIT
results VARCHAR

Any ideas would be great!!!

Thanks!

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Scott
  • 459
  • 2
  • 10
  • 1
    What have you tried so far? Hint: Stackoverflow is not a coding service. – James A Mohler Nov 18 '19 at 21:05
  • I've tried cflooping through using comma as a delimiter but it keeps breaking. Tried removing the quotes and it still was constantly causing errors. – Scott Nov 18 '19 at 21:11

2 Answers2

3

You need to have a proper CF object. cfhttp.filecontent is a just a string.

<cfscript>
data = DeserializeJSON(cfhttp.filecontent);


 writedump(data); // now you should have a proper cf variable.
</cfscript>

enter image description here

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
1

In tag based syntax you can use like this

<cfset content = cfhttp.Filecontent> 
<cfset data = DeserializeJSON(content)> 
U.Malik
  • 111
  • 11