0

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?

jambox
  • 584
  • 4
  • 15

1 Answers1

1

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.

Community
  • 1
  • 1
Vadorequest
  • 16,593
  • 24
  • 118
  • 215