JSON Object in Acrobat X

I'm using Acrobat X to create a dynamic form. Acrobat X uses Javascript 1.8 as I have read. Javascript 1.7 added native support for JSON using the JSON object. The JSON.stringify and JSON.parse methods would be really nice to have.... BUT WHERE IS IT? All the other Global Objects seem to be there (Math, Infinity, etc)


Beau Brewer


2 Answers

Voted Best Answer

Acrobat has had undocumented pseudo-JSON support for a long time. Maybe they didn't think they needed to add in the JSON object.

Use the <object>.toSource() function to convert any object into JS string notation and eval() to convert it back into an object.

Thom Parker
The source for PDF Scripting Info pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


By Thom Parker   

JSON is not a part of ECMAScript core. You can see here what was actually added to JavaScript 1.8: https://developer.mozilla.org/en/New_in_JavaScript_1.8

If you want, of course, you can download the JSON source code and install it as another folder-level script in your Acrobat, and it would be available to all scripts running within the application.


Gilad D (try67)   


Please specify a reason: