On RHEL 6.7 I installed the js-1.7 package using yum, which is handy to test out syntax before I use it for CouchDB list/view functions.
I want to use JSON.stringify() to print some objects. However, JSON isn't defined (as it would be in a browser) so I get:
$ js
js> JSON
typein:2: ReferenceError: JSON is not defined
Is it possible to use JSON in this shell?
You'll need 1.8.1 to have the JSON object built-in.
Read more at: JSON serialization in Spidermonkey
I flagged the question as duplicate, it may not be if you really need to use the 1.7 version since you'll need another solution then.