I am trying to serialize the following into JSON and checking the output in two ways as shown below :
Line #13 : <cfset convertjson = SerializeJSON([
{
"Id":"123",
"Value":"1",
"Desc":"Checking Description ",
"Group":"1"
}
])/>
Normal Output : <cfoutput>#convertjson#</cfoutput>
<br/>
Dump Output: <cfdump var="#convertjson#">
I am getting the following error:
Invalid CFML construct found on line 13 at column 98.
ColdFusion was looking at the following text:
:
The CFML compiler was processing:
An expression beginning with SerializeJSON, on line 11, column 26.This message is usually caused by a problem in the expressions structure.
A cfset tag beginning on line 11, column 2.
But I verified the JSON I am using, it is a valid JSON. What could be the problem?
ColdFusion 9 doesn't support using :
when creating a struct. Try
<cfset convertjson = SerializeJSON([
{
Id = "123",
value = "1",
Desc = "Checking Description ",
Group = "1"
}
])/>