• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can't manage to JSON.parse() in my CEP panel

Explorer ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

Hi,

i'm writing a CEP panel for indesign, and as i couldn't manage to JSON.parse my data string, i erased my code to test JSON with these 2 short lines in my index.js file :

var jsonTest=JSON.parse("{'test':'ok'}");
alert(jsonTest.test);

Could someone tell me why this doesn't give me any result ?

script is running (i tested with an alert() before the variable declaration) but

alert(jsonTest.test) isn't triggered.

(JSON is written in "variable color"... It migth be a clue as it should be green like any other global object... when i write it, it is green for a sec before it turns blue... Conflict somewhere ?)

 

Thanks fo reading.

Views

320

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jul 21, 2020 Jul 21, 2020

Ok i found out what was going on.

My JSON file wasn't valid, due to Marc Autret's json.jsx lave() function, which was outputting \xE8 for "è".

I don't know what i did wrong, as many people seems to use json.jsx without reporting any issue.

But i finally replaced json.jsx with json2.js, and got a valid JSON.

Will i encounter any other problem... We'll see !

 

Votes

Translate

Translate
Explorer ,
Jul 21, 2020 Jul 21, 2020

Copy link to clipboard

Copied

LATEST

Ok i found out what was going on.

My JSON file wasn't valid, due to Marc Autret's json.jsx lave() function, which was outputting \xE8 for "è".

I don't know what i did wrong, as many people seems to use json.jsx without reporting any issue.

But i finally replaced json.jsx with json2.js, and got a valid JSON.

Will i encounter any other problem... We'll see !

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines