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

JSON.stringify outputing wrong the ' character

Participant ,
Feb 27, 2020 Feb 27, 2020

Does someone know why if I JSON.stringify("You've won") it exports it like this??

 
 

TEMP.jpg

 

cheers!

TOPICS
Error or problem , Import and export , Scripting
1.6K
Translate
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
LEGEND ,
Feb 27, 2020 Feb 27, 2020

Export what from where? You need to be more specific and describe the exact situatiuon and include things like system info, langauge settings, character encodings ansd possibly even font info. Just throwing out such random bits is not useful to anyone.

 

Mylenium

Translate
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
Participant ,
Feb 27, 2020 Feb 27, 2020

You are right, sorry.

 

I have a layer in the composition with that text, so I'm reading it like this:
JSON.stringify(layer.property("ADBE Text Properties").property("ADBE Text Document").value.text)

Latest AE version
Windows 10 ENG
no encodig asfaik, I have not setup that

Funny thing is that now is working properly... I don't know what could have happend

Translate
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
Advocate ,
Feb 27, 2020 Feb 27, 2020

From what environment are you calling JSON.stringify?

From CEP panel (JS) or ExtendScript (JSX)?

Translate
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
Participant ,
Feb 28, 2020 Feb 28, 2020

From extendedScript

Translate
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
Advocate ,
Feb 28, 2020 Feb 28, 2020

Right, OK, let me jump ahead and say that by default JSON is not included in ExtendScript. Meaning, that it does not exist out of the box in ExtendeScript.

 

However, if you are still able to use JSON without specifically including it yourself, then this means that some other third tool is modifying global space and injecting JSON into the app. This is bad, and you should never rely on this.

 

If you need to use JSON in your script, you should always include it yourself:

1. Download this https://github.com/douglascrockford/JSON-js/blob/master/json2.js?

2. Then in your JSX file use include to load JSON into your local script scope: #include 'path/to/json2.js'

 

So now you end up with the JSON version that you can control, without relying on JSON injected by accident by third parties.

Translate
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
Participant ,
Mar 06, 2020 Mar 06, 2020

Thanks a lot for your answer and your help Tomas!

Translate
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
New Here ,
Aug 27, 2021 Aug 27, 2021
LATEST

Hi @Tomas Sinkunas

 

I've seen you around helping people, thank you so much for that.
I'm wondering if you know if the json2.js still works (https://github.com/douglascrockford/JSON-js/blob/master/json2.js?)?

I run Adobe After effects 2021 and Extendscript toolkit. I try to #include 'path/to/json2.js' but when I run Main flach at row 119, and result in = Result: undefined



 

 

 

 

 

Translate
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