JSON serialization in Spidermonkey

I use python-spidermonkeyjavascript to run the code.

To pass objects (instead of simple strings) to Python, I am thinking of returning a JSON string.

This seems like a common problem, so I wonder if there are any tools for this built-in to Spidermonkey or python-spidermonkey. (I know about uneval, but this is not intended to be used to serialize JSON - and I would rather not enter a JavaScript block for this.)

+3
source share
1 answer

I would use JSON.stringify. It is part of the ECMAScript 5 standard and is implemented in the current version of spidermonkey. I do not know if this is in the version used by python-spidermonkey, but if it is not, you can get the JavaScript implementation from http://www.json.org/js.html .

+6
source

Source: https://habr.com/ru/post/1711452/


All Articles