Skip to main content
Dhal_Naka
Inspiring
February 27, 2020
Question

JSON.stringify outputing wrong the ' character

  • February 27, 2020
  • 2 replies
  • 1632 views

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

 
 

 

cheers!

This topic has been closed for replies.

2 replies

Tomas Sinkunas
Legend
February 27, 2020

From what environment are you calling JSON.stringify?

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

Dhal_Naka
Dhal_NakaAuthor
Inspiring
February 28, 2020

From extendedScript

Tomas Sinkunas
Legend
February 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.

Mylenium
Legend
February 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

Dhal_Naka
Dhal_NakaAuthor
Inspiring
February 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