Jason stringify

Topics: Developer Forum
Oct 22, 2013 at 5:33 PM
I was wondering if I am following the correct method for sending Json object to the browser.

Say, I want to return a simple JSON as follows to the browser
cJSON = [{"error":false, "msg":"Thank you.."}]
In this case my REST controller does the following ( this is the simplified version)
ADDPROPERTY(oRawJSON,"msg","Thank You.")
cJSON =  oJSON.stringify(oRawJSON)
oRawJSON = null
Return cJSON
Does anyone know if we can create Json without using CreateObject()?
Oct 27, 2013 at 8:59 AM
Edited Oct 27, 2013 at 8:59 AM
There's probably many different ways worth experimenting with.

In some of Victor's code he just does (and he created this project: https://qdfoxjson.codeplex.com/):
 *quick and dirty JSON
   cJSON = [{"custId":"] + RTRIM(custId) + [","custName":"] + RTRIM(custName) + [",] + ;
           ["custStat":"] + RTRIM(custStat) + ["}]
Although, I think the header needs to be formatted correctly for proper JSON.

And any JSON you produce should always pass the test here: http://jsonlint.com/
Oct 28, 2013 at 2:59 AM
Thanks claude. I did not know of that site.