I am trying to output certain key values to show(WHICH I AM GETTING ALREADY). But for some reason it is returning as a struct. Basically, I am converting from query statement into api call. But for some reason I cant get it return from cfoutput
to show as a struct from the api call or a json file. Can anyone tell me what I have done wrong. thanks for the help. here is my code:
Output: I get all my json fields showing in a struct. (with cfscript
uncommented out)
Update output with current code: (I get my output of certain key value, but can I do iterate through a loop, I know the way I have it is not the best way)
<cfset?jsonDatas?=?fileRead("c:UsersDesktopmyApi.json"?)>?????
<cfset?jsonData?=?deserializeJSON(jsonDatas)?/>??????
<cfdump?var="#jsonData#"?abort="true">??
<cfloop?array="#jsonData#"?index="prop">??
<cfoutput>
<br>Output:?
#prop.employeeId#
.....
</cfoutput>
?</cfloop>?
My Json:
[?
{?
?"employeeId"?:?"77777",??
"lastName"?:?"DOE",??
"firstName"?:?"JOHN",??
"middleName"?:?null,??
"sex"?:?"Male",??
"jobStatus"?:?"Active",?
"jobStatusDate"?:?"2020-01 03?00:00:00.0",??
"departmentNbr"?:?"5555",
}
]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…