I'm using this lib to display emojis.
I want to get my data from a JSON, but for some reason the lib cannot convert a string from JSON.
When I create my own string with the same data, e.g. '\uD83D\uDE18' it displays without any problem.
emojis.posts[0].content == '\uD83D\uDE18'
returned false
So my question is, what is the difference between a 'normal' string and a 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 a JSON in JS
var emojis = JSON.parse('{"title": "l\\u2764 you\\uD83D\\uDE18"}');
console.log(emojis.title);
returns 'l❤ you'
Found the answer: https://stackoverflow.com/a/7885499/6216557
This is a unicode, escaped string. First the string was escaped, then encoded with unicode