Json from rest question

Quick question: serializeJSON dosent return json that my other applications can consume easily. Running 5.4

.cfc file :
<cfreturn serializeJSON(userQueryData, "true")>

Returns:
"{\"token\":\"9F5ADF78-24B7-43A6-8939389D6302074F\"}"

How do I get it to return:
{"token":"1122A425-79C1-44C2-B34748A4D2194663"}

Without the extra " " and \ (backslashes) in the string.

I am using jsonpath. And I cannot get the path of token:

None of the json path examples have \ in their json.
for example: JSON with JSONPath

SerializeJSON for queries works well, I use it very often.
Those extra backslashes make me think that you are serializing data that has already been serialized.

Can we see the contents of userQueryData? Does it contains a JSON values?

1 Like

You totally correct. total brain fart on my part. Thank you!

<cfset userQueryData = {}>
<cfset userQueryData["token"] = newuuid>
<cfreturn serializeJSON(userQueryData, "true")>

I should just return <cfreturn userQueryData)>