LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service VI - Output for empty array not empty

Hello!

 

I recently ran into a strange behavior with a LabVIEW Web Service VI. I Have a simple VI (GET method) that is returning an array of data. Sometimes this array can be empty (which is totally fine) but when using the "Output Type -> Terminal -> JSON" the response the web service is sending to my browser is not empty at all.

 

Here is a very simple example:

 

When using the flatten to JSON function the resulting JSON string does exactly look like I would expect LV doing it with the "auto JSON" function for the indicator terminal.

 

Jens_S_3-1654604635116.png

 

But the response to the web request does look like this:

 

Jens_S_2-1654604359177.png

For each request there is different random data for the "Numeric" and "Double" objects. This behavior is very confusing. If the array is empty then the JSON response should look like the one in the first picture ("JSON string").

Am I doing something wrong or is this just a bug?

0 Kudos
Message 1 of 3
(974 Views)

Since none of us have a magic 8-ball that tells us what's happening in your code we're left to guess. How have you confirmed that the array is indeed empty? Have you been able to reproduce this with simulated data? If not why do you think that is? 

0 Kudos
Message 2 of 3
(928 Views)

There is no code .. just what you see in the pictures, an empty array wired to an indicator that is connected to the web VIs connector pane. The flatten to JSON is just to show the expected result. How can I confirm it is empty? The flatten to JSON does show it, the indicator too and a probe when debugging it as well - so yes it is 100% empty.

 

The moment you fill in some data into the array everything is fine.

I attached an example project just start the web service and call the test method from a Browser of your choice. You always get an array with 1 element (so not empty) always with an empty string but sometimes with random data for the decimal and double values (just refresh the website over and over and you will see).

0 Kudos
Message 3 of 3
(895 Views)