How to parse JSON from jsx to js
Hi There,
I'm trying to parse a JSON Object from a .jsx file to .js. I've searched the forum but i cant seem to find the answer. When i use a plane String it does work, but i dont know how to include the json2.jsx in the .js file. And is there a way to debug the .js code?. I'm using Visual Studio Code with extendscript debugger so i can debug the .jsx but not the .js
Any help would be appreciated. Thanks.
My code looks like this.
JS File
// how do i include json2.jsx here? (it doesnt seem to work)
function init()
{
var layerSettings = document.getElementById("layerSettings");
csInterface.evalScript("getJson()", function (result)
{
var r = JSON.parse(result)
layerSettings.innerHTML = r.name;
});
}
JSX File
//@include json2.jsx
function getJson()
{
var ar = {name: "John", age: 31, city: "New York"};
var stringAr = JSON.stringify(ar);
return stringAr;
}

