A descriptor in JSON AM Data Format is represented as a JSON object { } (not to be confused with the Photoshop API Object type, whose tag is "<object>" as described below), where each item in the descriptor is expressed as a unique key unified ID string associated with a “typed value”:
| Typed Value | Parameters | ActionDescriptor Methods |
|---|---|---|
{ "<boolean>": Boolean }or [ "<boolean>", Boolean ] |
Boolean : true or false |
desc.getBooleandesc.putBoolean |
{ "<class>": Class }or [ "<class>", Class ] |
Class : class unified ID string | desc.getClassdesc.putClass |
{ "<data>": Data }or [ "<data>", Data ] |
Data : raw byte data string | desc.getDatadesc.putData(only from CS2) |
{ "<double>": Double }or [ "<double>", Double ] |
Double : number | desc.getDoubledesc.putDouble |
{ "<enumerated>": { EnumType: EnumValue } }or [ "<enumerated>", [ EnumType, EnumValue ] ] |
EnumType : enumType unified ID string EnumValue : enumValue unified ID string |
desc.getEnumerationTypedesc.getEnumerationValuedesc.putEnumerated |
{ "<integer>": Integer }or [ "<integer>", Integer ] |
Integer : number (signed integer) | desc.getIntegerdesc.putInteger |
{ "<largeInteger>": LargeInteger }or [ "<largeInteger>", LargeInteger ] |
LargeInteger : number (signed integer) | desc.getLargeIntegerdesc.putLargeInteger(only from CS6) |
{ "<list>": List }or [ "<list>", List ] |
List : JSON AM list array | desc.getListdesc.putList |
{ "<object>": { Class: Descriptor } }or [ "<object>", [ Class, Descriptor ] ] |
Class : class unified ID string Descriptor : JSON AM descriptor object |
desc.getObjectTypedesc.getObjectValuedesc.putObject |
{ "<path>": Path }or [ "<path>", Path ] |
Path : file system path string | desc.getPathdesc.putPath |
{ "<reference>": Reference }or [ "<reference>", Reference ] |
Reference : JSON AM reference array | desc.getReferencedesc.putReference |
{ "<string>": String }or [ "<string>", String ] |
String : string | desc.getStringdesc.putString |
{ "<unitDouble>": { Unit: Double } }or [ "<unitDouble>", [ Unit, Double ] ] |
Unit : unit unified ID string Double : number |
desc.getUnitDoubleTypedesc.getUnitDoubleValuedesc.putUnitDouble |
{
"mode": { "<class>": "RGBColorMode" },
"width": { "<unitDouble>": { "distanceUnit": 512 } },
"height": { "<unitDouble>": { "distanceUnit": 512 } },
"resolution": { "<unitDouble>": { "densityUnit": 72 } },
"pixelScaleFactor": { "<double>": 1 },
"fill": { "<enumerated>": { "fill": "white" } },
"depth": { "<integer>": 8 },
"profile": { "<string>": "sRGB IEC61966-2.1" }
}or
{
"mode": [ "<class>", "RGBColorMode" ],
"width": [ "<unitDouble>", [ "distanceUnit", 512 ] ],
"height": [ "<unitDouble>", [ "distanceUnit", 512 ] ],
"resolution": [ "<unitDouble>", [ "densityUnit", 72 ] ],
"pixelScaleFactor": [ "<double>", 1 ],
"fill": [ "<enumerated>", [ "fill", "white" ] ],
"depth": [ "<integer>", 8 ],
"profile": [ "<string>", "sRGB IEC61966-2.1" ]
}A list in JSON AM Data Format is represented as a JSON array [ ], where each element of the array is a “typed value”:
| Typed Value | Parameters | ActionList Methods |
|---|---|---|
{ "<boolean>": Boolean }or [ "<boolean>", Boolean ] |
Boolean : true or false |
list.getBooleanlist.putBoolean |
{ "<class>": Class }or [ "<class>", Class ] |
Class : class unified ID string | list.getClasslist.putClass |
{ "<data>": Data }or [ "<data>", Data ] |
Data : raw byte data string | list.getDatalist.putData(only from CS2) |
{ "<double>": Double }or [ "<double>", Double ] |
Double : number | list.getDoublelist.putDouble |
{ "<enumerated>": { EnumType: EnumValue } }or [ "<enumerated>", [ EnumType, EnumValue ] ] |
EnumType : enumType unified ID string EnumValue : enumValue unified ID string |
list.getEnumerationTypelist.getEnumerationValuelist.putEnumerated |
{ "<integer>": Integer }or [ "<integer>", Integer ] |
Integer : number (signed integer) | list.getIntegerlist.putInteger |
{ "<largeInteger>": LargeInteger }or [ "<largeInteger>", LargeInteger ] |
LargeInteger : number (signed integer) | list.getLargeIntegerlist.putLargeInteger(only from CS6) |
{ "<list>": List }or [ "<list>", List ] |
List : JSON AM list array | list.getListlist.putList |
{ "<object>": { Class: Descriptor } }or [ "<object>", [ Class, Descriptor ] ] |
Class : class unified ID string Descriptor : JSON AM descriptor object |
list.getObjectTypelist.getObjectValuelist.putObject |
{ "<path>": Path }or [ "<path>", Path ] |
Path : file system path string | list.getPathlist.putPath |
{ "<reference>": Reference }or [ "<reference>", Reference ] |
Reference : JSON AM reference array | list.getReferencelist.putReference |
{ "<string>": String }or [ "<string>", String ] |
String : string | list.getStringlist.putString |
{ "<unitDouble>": { Unit: Double } }or [ "<unitDouble>", [ Unit, Double ] ] |
Unit : unit unified ID string Double : number |
list.getUnitDoubleTypelist.getUnitDoubleValuelist.putUnitDouble |
[
{ "<string>": "Times" },
{ "<string>": "Helvetica" },
{ "<string>": "Monaco" }
]or
[
[ "<string>", "Times" ],
[ "<string>", "Helvetica" ],
[ "<string>", "Monaco" ]
]A reference in JSON AM Data Format is represented as a JSON array [ ], where each element of the array is either:
{ DesiredClass: TypedValue }
or
[ DesiredClass, TypedValue ]
DesiredClass is a class unified ID string, and TypedValue is a “typed value”:
| Typed Value | Parameters | ActionReference Methods |
|---|---|---|
{ "<class>": null }or [ "<class>", null ] |
(none) | (none)ref.putClass |
{ "<enumerated>": { EnumType: EnumValue } }or [ "<enumerated>", [ EnumType, EnumValue ] ] |
EnumType : enumType unified ID string EnumValue : enumValue unified ID string |
ref.getEnumeratedTyperef.getEnumeratedValueref.putEnumerated |
{ "<identifier>": Identifier }or [ "<identifier>", Identifier ] |
Identifier : number (unsigned integer) | ref.getIdentifierref.putIdentifier |
{ "<index>": Index }or [ "<index>", Index ] |
Index : number (unsigned integer) | ref.getIndexref.putIndex |
{ "<name>": Name }or [ "<name>", Name ] |
Name : string | ref.getNameref.putName |
{ "<offset>": Offset }or [ "<offset>", Offset ] |
Offset : number (signed integer) | ref.getOffsetref.putOffset |
{ "<property>": Property }or [ "<property>", Property ] |
Property : property (key) unified ID string | ref.getPropertyref.putProperty |
[
{ "property": { "<property>": "histogram" } },
{ "channel": { "<enumerated>": { "channel": "green" } } },
{ "layer": { "<name>": "Hulk" } },
{ "document": { "<index>": 1 } }
]or
[
[ "property", [ "<property>", "histogram" ] ],
[ "channel", [ "<enumerated>", [ "channel", "green" ] ] ],
[ "layer", [ "<name>", "Hulk" ] ],
[ "document", [ "<index>", 1 ] ]
]| ID String | Unified Syntax | Examples | Application Methods |
|---|---|---|---|
| CharID | Four-letter “mnemonic” string surrounded by single quotation marks: "'xxxx'" |
"'Rd '""'Grn '""'Bl '""'H '""'Axis'""'#Pxl'" |
app.charIDToTypeIDapp.typeIDToCharID |
| StringID | Plain “human-readable” text string:"xxxxxxxx" |
"red""green""blue""hue""axis""pixelsUnit" |
app.stringIDToTypeIDapp.typeIDToStringID |
Note: In Photoshop, all internal IDs are strictly positive integers; they are normally represented by more “readable” strings known as CharIDs and StringIDs, converted to numerical IDs by app.charIDToTypeID and app.stringIDToTypeID respectively. Any CharID or StringID can actually be used as long as they are equivalent, i.e., they get converted to the same numerical ID.
-
A JSON object is an unordered collection of name/value pairs. It begins with { (left brace) and ends with } (right brace). Each name is a string followed by : (colon) and the name/value pairs are separated by , (comma).
-
A JSON array is an ordered sequence of values. It begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).
-
A value can only be: a string, a number, an object, an array, or
true,falseandnull. -
All strings must be enclosed in double quotes.
-
As an extra reminder, it should be noted that the following JavaScript statements:
var myObject = { };
var myArray = [ ];are strictly equivalent to:
var myObject = new Object ();
var myArray = new Array ();