Skip to main content
stib
Inspiring
May 7, 2020
Answered

Scripting: Is the JavaScript JSON class available for scripts by default?

  • May 7, 2020
  • 3 replies
  • 3037 views

I'm writing a script and want to use JSON.stringify() etc., and I'm wondering if it is available as a built-in function for scripts (not talking about expressions here).

 

If I try it it works, but in the debugger it says that the definition is actually provided by the DUIK scripts that I have installed, so I don't know if 

JSON.stringify()

and 

JSON.parse()

will work on a machine that doesn't have DUIK installed (asking so I don't have to unistall and reinstall).

This topic has been closed for replies.
Correct answer Tomas Sinkunas

No, JSON is not natively included in ExtendScript.

What we, script developers usually do, is use this library: https://github.com/douglascrockford/JSON-js/blob/master/json2.js?

Simply download this file, and the use #include 'path/to/json2.js' in your main script to use JSON features.

3 replies

Mathias Moehl
Community Expert
Community Expert
May 7, 2020
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Tomas Sinkunas
Tomas SinkunasCorrect answer
Legend
May 7, 2020

No, JSON is not natively included in ExtendScript.

What we, script developers usually do, is use this library: https://github.com/douglascrockford/JSON-js/blob/master/json2.js?

Simply download this file, and the use #include 'path/to/json2.js' in your main script to use JSON features.

Mylenium
Legend
May 7, 2020

Nope. Those are clearly external node.js functions (or for that matter any of those fancy libraries using them).

 

Mylenium