From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unflatten from JSON dies on "NULL" responses

Solved!
Go to solution

I am trying to use the "Unflatten from JSON" function (fwiw, I have also been working with the i3 LV JSON library too, and have the same problem.).

 

I am interfacing an API where the JSON for a particular text field is coming back as 'null' (no quotes).

So when there is valid text, it parses fine (the text is in quotes).  When the field is null, the parser throws an exception.

I have tried replacing :null in the JSON with :"" however, this particular API also reports back nulls for numerics; so I can't do that without shooting myself in the foot.

1) Is null valid JSON data?

2) If so, can we get the parser to handle it, and return default data type data + issue a warning?

0 Kudos
Message 1 of 3
(2,984 Views)

Quick reply, I looked on the web and using null in this way appears to be OK within the JSON spec.

 

I suggest that null as a numeric be updated as NaN, and that null as a string be updated as either an empty string or "#NULL#" or something that can be handled.

0 Kudos
Message 2 of 3
(2,978 Views)
Solution
Accepted by topic author Jed_Davidow

And, of course, as soon as I post and make a stink, I notice the "Default NULL elements" option, that handles exactly the problem I have been having.

 

Sorry to bother you all.

Message 3 of 3
(2,968 Views)