LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Entering Text in Strings places \00 before brackets and braces which invalidates json data

I am using Labview community on a Ubuntu linux system.

When working with Json flatten to string the flatten fails with:

hartmutjacobi_0-1700556805780.png

putting brackets and braces in the text adds \00.

Any solution on this?

0 Kudos
Message 1 of 4
(481 Views)

Hi Hartmut,

 

I don't know if the JSON functions have a special behavior in Linux systems, but how did you create your JSON string in first place ?

What data type do you flatten / unflatten ? We need some code example to understand what you are trying to do.

 

Here is an example of the flattening of a cluster containing a string "data" with brackets in its value:

 

raphschru_0-1700561822791.png

 

Regards,

Raphaël.

0 Kudos
Message 2 of 4
(462 Views)

I find the JSON primitives lacking in many ways.  Use the JSONtext library by JDP Science.  It is far and away the best JSON library out there.  It is freely available through VIPM.  I haven't tried it myself, but I'm pretty sure it will work on Linux.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(448 Views)

Assuming the string being shown has '\' Codes Display enabled and the string has an actual null (\00) character as a whitespace token, the string is an invalid JSON string.

In the JSON snippet {"data":[]} the only whitespace characters allowed between the : and the opening [ are space, tab, and the newline characters.

See the definition of whitespace on json.org: https://www.json.org/json-en.html

So whatever is generating the JSON string using the null character as a whitespace character is generating invalid JSON.

 


Milan
0 Kudos
Message 4 of 4
(409 Views)