extendscript-json
v0.1.1
Published
Adobe ExtendScript compatible JSON library
Downloads
13
Readme
Overview
extendscript-json provides a standalone JSON library that works with Adobe ExtendScript.
Installation
Simply install it like any other npm package.
npm install extendscript-json
Add the following to any ExtendScript (*.jsx
) file where JSON availability is desired.
var Global = Global || {};
Global.rootPath = new File($.fileName).parent;
$.evalFile(Global.rootPath + '/node_modules/extendscript-json/index.jsx');
Usage
var serialized = JSON.stringify({"a": 1, "test it":[1,'2']});
var parsed = JSON.parse(serialized);
parsed.a; //=> 1
parsed['test it']; //=> [1,"2"]
JSON.stringify('[bad json'); //=> parse error
Testing
npm test
or test/run
.
Output should look like:
me@host> test/run
2020-03-12T14:17:21|INFO|***************************
2020-03-12T14:17:21|INFO|Jasmine ExtendScript Runner
2020-03-12T14:17:21|INFO|***************************
2020-03-12T14:17:22|WARN|To prevent odd errors, usually methods not being defined, login into Adobe Creative Cloud and verify all modal dialog boxes are closed. If tests are not running as expected, try restarting the application.
2020-03-12T14:17:22|INFO|Loading all specs in /Users/me/projects/extendscript-json/test/spec
2020-03-12T14:17:24|INFO|26 specs, 0 failures
2020-03-12T14:17:24|INFO|Finished in 0.016 seconds
NPM Release Tasks
- Update
package.json
version number npm install
to update package lock.- Ensure tests pass.
- Update
CHANGELOG.md
with changes since last release. - Check them all into the repository.
git tag -a <version> -m <version>; git push --tags
npm publish
to deploy the release to npm.
Thanks
A big thank you to @douglascrockford for making and maintaining the JSON2 library.