Showing results for 
Search instead for 
Did you mean: 

Trouble with emojis in a json string

When I try to unflatten an emoji from JSON I'm getting an error. I realize I'm not going to get the emoji out because LV doesn't support unicode yet but I believe the text is valid JSON so I don't think I should be getting a syntax error either.


Error -375003 occurred at Unflatten From JSON in parse

Possible reason(s):

LabVIEW: (Hex 0xFFFA4725) The JSON string is invalid. JSON strings must be encoded in UTF-8 and must conform to the JSON grammar.

CLED (2016)
0 Kudos
Message 1 of 5


Emojis are UTF-16. Just ✔the HTML here.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 5

Have you tried the JSONtext toolkit? That emits a "??" string in place of the emoji, but otherwise parses the JSON text correctly.


@JÞB wrote:


Emojis are UTF-16. Just ✔the HTML here.


UTF-8 can handle emojis just fine. The HTML of this forum page is encoded as UTF-8.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 3 of 5

@JÞB wrote:


Emojis are UTF-16. Just ✔the HTML here.

Any Unicode character can be represented in UTF-8, 16, and 32 and there are very simple mathematical translations to do so, although most choose to translate between UTF-8 and UTF-16 by going through UTF-32 in a tradeoff between speed and simplicity.

The emoji in the example is in proper UTF-8 but the current ANSI local doesn’t support it and LaBVIEW tries to convert the UTF-8 JSON string into an ANSI string and that fails. JSONText chooses to replace the “invalid” character with a placeholder (and seems to stumble over the fact that this is a 4 byte UTF-8 codepoint, representing it as two placeholders instead of one).

Rolf Kalbermatter
My Blog
Message 4 of 5

I did some experimentation. It really seems to be a matter of the 4 byte code point that it's choking on. Here's it choking on a script A. Other code point, it just converts to a question mark which is preferred to throwing an error.


test json2.png

0 Kudos
Message 5 of 5