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

JSON.stringify outputing wrong the ' character

Participant ,
Feb 27, 2020 Feb 27, 2020

Copy link to clipboard

Copied

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

Views

1.1K

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

From what environment are you calling JSON.stringify?

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

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

Copy link to clipboard

Copied

From extendedScript

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

Thanks a lot for your answer and your help Tomas!

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

Copy link to clipboard

Copied

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



 

 

 

 

 

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