javascript - Why does JS String differ from JSON String? -


i'm using this lib display emojis.

i want data json, reason lib cannot convert string json. when create own string same data, e.g. '\ud83d\ude18' displays without problem. emojis.posts[0].content == '\ud83d\ude18' returned false

so question is, difference between 'normal' string , json string?

json

{    "title": "l\\u2764 you\\ud83d\\ude18" } 

...

var emojis = json.parse(jsonstring); console.log(emojis.title); 

returns 'l\u2764 you\ud83d\ude18'

creating json in js

var emojis = json.parse('{"title": "l\\u2764 you\\ud83d\\ude18"}'); console.log(emojis.title); 

returns 'l❤ you😘'

found answer: https://stackoverflow.com/a/7885499/6216557

this unicode, escaped string. first string escaped, encoded unicode


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -