Flatten cfhttp json return to query

I have a cfhttp that returned in Json format. I processed the return using
deserializejson that produced the below dump. Is there a way to flatten
the Type and Status Variables and put this into a query?

Thanks,

Dale

StructresultArray1Struct
Entries: 13namestringADAMS SEWERidstringSANLEANDRO-DUB15-00000-00156type
StructmodulestringBuildingvaluestringBuilding/OTC/Residential Sewer/NAtype
stringOTCtextstringResidential SewergroupstringBuildingsubTypestringResidential
SewercategorystringNAaliasstringResidential Seweridstring
Building-OTC-Residential.cSewer-NAdescriptionstringREPLACE SEWER LINE FROM
HOUSE TO MAIN LOCATED AT REAR OF DWELLING.modulestringBuildingstatusStruct
valuestringIssuedtextstringIssuedcreatedBystringCCUEROserviceProviderCode
stringSANLEANDROopenedDatestring2015-07-31 00:00:00trackingIdnumber200767209
customIdstringB15-0988jobValuenumber8000valuestringDUB15-00000-00156status
number200pageStructoffsetnumber0limitnumber1hasmorebooleantrue

You can certainly create a query from it easily enough, assuming all of the structs in the result array have the same keys:

var results = deSerializeJSON(cfhttp.filecontent).result;
var qResult = queryNew(structKeyList(results[1]));
for(var result in results){
var rowNumber = queryAddRow(qResult);
for(var key in result){
querySetCell(qResult,key,result[key],rowNumber);
}
}
That seems like extra work, though when you could just loop the array and work with the structs, themselves, directly:

var results = deSerializeJSON(cfhttp.filecontent).result;
for (var result in results){
//do stuff with struct here
}On December 21, 2015 at 4:35:33 PM, @trivalleybrewers (@trivalleybrewers) wrote:

I have a cfhttp that returned in Json format. I processed the return using deserializejson that produced the below dump. Is there a way to flatten the Type and Status Variables and put this into a query?

Thanks,

Dale

Struct
result
Array
1
Struct
Entries: 13
name
string ADAMS SEWER
id
string SANLEANDRO-DUB15-00000-00156
type
Struct
module
string Building
value
string Building/OTC/Residential Sewer/NA
type
string OTC
text
string Residential Sewer
group
string Building
subType
string Residential Sewer
category
string NA
alias
string Residential Sewer
id
string Building-OTC-Residential.cSewer-NA
description
string REPLACE SEWER LINE FROM HOUSE TO MAIN LOCATED AT REAR OF DWELLING.
module
string Building
status
Struct
value
string Issued
text
string Issued
createdBy
string CCUERO
serviceProviderCode
string SANLEANDRO
openedDate
string 2015-07-31 00:00:00
trackingId
number 200767209
customId
string B15-0988
jobValue
number 8000
value
string DUB15-00000-00156
status
number 200
page
Struct
offset
number 0
limit
number 1
hasmore
boolean true –
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/414e72cb-133f-4660-a852-587f8c82b25b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.