Highlighted

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

Engaged ,
May 06, 2020

Copy link to clipboard

Copied

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).

Adobe Community Professional
Correct answer by Tomas_Sinkunas | Adobe Community Professional

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.

TOPICS
Scripting

Views

712

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

Engaged ,
May 06, 2020

Copy link to clipboard

Copied

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).

Adobe Community Professional
Correct answer by Tomas_Sinkunas | Adobe Community Professional

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.

TOPICS
Scripting

Views

713

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 06, 2020 0
Most Valuable Participant ,
May 06, 2020

Copy link to clipboard

Copied

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

 

Mylenium

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 06, 2020 1
Adobe Community Professional ,
May 06, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 06, 2020 2
Adobe Community Professional ,
May 07, 2020

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 07, 2020 0