You need to sign in to do that
Don't have an account?
sachin.ramdasi
Creating JSON array in Apex
Hi
I'm looking for some function/utility/feature in Apex which will returns the JSON representation of a value. The return value should be a string containing the JSON representation of value.
We need to query some data from SF object and then pass on that data as a JSON string to a ExtJS (javascript library) to build a dynamic tree.
There is similar function available in PHP http://php.net/manual/en/function.json-encode.php, is there anything similar to this in Apex as well?
Any pointers to this will be a great help.
Thanks
Sachin
The closest you'd get in Apex is currently ... Object.toString() (as evidenced by running some code and looking at System.Debug() statements). However, one of my favorite developers, Ron Hess, posted an example of how to do JSON on CodeShare: http://developer.force.com/codeshare/projectpage?id=a0630000002ahp4AAA. You might check it out and see if it suits your needs, or if you can at least build on it.