1
Contributor
,
/t5/indesign-discussions/add-the-data-from-the-json-file-into-xmp-raw-data-using-js/td-p/12696898
Jan 21, 2022
Jan 21, 2022
Copy link to clipboard
Copied
Hi All,
Is it possible to update the data from json file into Indesign file info XMP rawdata using Indesign JS?
JSON format
JSON data = {
"Name":"XXXX",
"id":"XXXX",
"Address":"XXXX"
}
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
Jan 21, 2022
Jan 21, 2022
Hi Rocky@ , Would something like this work?
var md = app.activeDocument.metadataPreferences;
var ns = "http://ns.adobe.com/xap/1.0/";
var p, v;
//the json object
var o = {"Name":"John Doe","id":"1234","Address":"Main Street"}
var props = o.reflect.properties;
for (var i = 0; i < props.length-4; i++){
p = props[i].name
v = o[props[i]]
md.setProperty(ns, p, v)
};
JSON gets added to Raw Data
Community Expert
,
LATEST
/t5/indesign-discussions/add-the-data-from-the-json-file-into-xmp-raw-data-using-js/m-p/12697091#M462362
Jan 21, 2022
Jan 21, 2022
Copy link to clipboard
Copied
Hi Rocky@ , Would something like this work?
var md = app.activeDocument.metadataPreferences;
var ns = "http://ns.adobe.com/xap/1.0/";
var p, v;
//the json object
var o = {"Name":"John Doe","id":"1234","Address":"Main Street"}
var props = o.reflect.properties;
for (var i = 0; i < props.length-4; i++){
p = props[i].name
v = o[props[i]]
md.setProperty(ns, p, v)
};
JSON gets added to Raw Data
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

