02-11-2023 05:45 PM - edited 02-11-2023 06:20 PM
Hi,
I have a JSON setting file witch is loaded from my .VI
My JSON is like this:
I need to write the charactère 0x00 which is \u0000 but when I do that labview can't interpret it:
It replaces all the data by "?".
Here is my the labview structure I use:
Do you have a fix?
Thanks for taking a look at my situation.
Solved! Go to Solution.
02-12-2023 02:34 AM
The standard JSON functions that come with LabVIEW have a known bug of truncating strings at the first zero, even if that zero is properly represented as \u0000. You will need to use a different JSON library, such as JSONtext (which I wrote).
BTW, you shouldn't need to do all that utf8 conversion; the JSON functions should handle that.
02-12-2023 11:17 AM
Thanks for your response.
So I have used the lib you tell me JSONtext and it works well,
Here's is my labview (there may be a better way to do this).
Have a good day
09-27-2024 11:25 AM
Hello, I'm beeing using the JSONtext library for a while and I'm still having issue with the "From Json text.vi".
The VI does not convert properly Extend ASCII format. Those caracter are convert to "?"
Is there a way to force the VI to convert correctly?
09-27-2024 11:51 AM
I have used JSONtext in the past for many JSON things I run into, but I have found the same thing as you when trying to import text using upper ASCII in it.
To be fair to the JSONtext library I have been using an old version (1.4.4.89) so it may be better now. There are some things in recent patch notes I see about Unicode which might also imply support for upper ASCII.
On an application where I encountered upper ASCII, I used the "i3 JSON" toolkit instead:
https://www.vipm.io/package/i3_json/
It's not as easy to use and seems to be a bit slower, but it also didn't have a problem with those extended characters.
So I would try first seeing if you have an updated version of JSON text and if that doesn't work, try the i3 library.
09-28-2024 08:36 AM
Your problem lies with whatever produced your psuedo-"JSON" string, as JSON is always UTF-8 encoded. Interpreted as UTF-8, your string has invalid characters, that show up as question marks when JSONtext tries the convert the "UTF-8" to extended ASCII.
If you can't fix the bug in the code generating the input string, try converting it to UTF-8, using the (off-pallet) conversion function: