JSON does not output correctly after using SerializeJSON

I am trying to serialize the following to JSON and validate 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 have checked the JSON I am using is valid JSON. What could be the problem?

+3


source to share


1 answer


ColdFusion 9 does not support use :

when creating a framework. Try



<cfset convertjson = SerializeJSON([
  {
   Id = "123",
   value = "1",
   Desc = "Checking Description ",
   Group = "1"
  }
])/>

      

+11


source







All Articles