Apr 20, 2011 at 2:30 PM

How I pass out an json object to an javascript by SetParameter("my_json_object", json_object)?

It only returns an string.

Apr 24, 2011 at 5:44 AM

JSON is not an object it's only a notation which represents object, therefore if you do 'eval(my_json_object)' you will get an object (or error in case of malformed json data). But such technique is not safe and you should not use it unless the source of the json object is trusted.

There is a JSON global object which has 'parse' and 'stringify' methods in ecma262.5, but currently they are not implemented in Jint.

Alternatively you can pass an object instead of a string.

Jul 3, 2011 at 10:49 PM

You could also use Douglas Crockford's json2.js

It can be found here: https://github.com/douglascrockford/JSON-js

I haven't tested it thoroughly yet, but for at least a simple case, this seems to 'play nice' with Jint.

Sep 7, 2011 at 3:25 PM

Douglas Crockford's json2, does not work with Jint 0.8.9, but works with 0.9.0.