我正在尝试将以下序列化为JSON并以两种方式检查输出,如下所示:
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#">
我收到以下错误:
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.
但我验证了我正在使用的JSON,它是一个有效的JSON。可能是什么问题?
答案 0 :(得分:11)
ColdFusion 9在创建结构时不支持使用:
。尝试
<cfset convertjson = SerializeJSON([
{
Id = "123",
value = "1",
Desc = "Checking Description ",
Group = "1"
}
])/>