LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Read JSON from LabVIEW Web Service HTTP VIs

Solved!
Go to solution

I am using this article to submit Web Server JSON Web Service response as 2D array.

 

However, the LabVIEW Web Service client gets an empty curly bracket {} result.

The article is here:

How to Send a Response as JSON Format From LabVIEW Web Service - NI

 

PNG of my Web Server VI and Web Service Client are attached. There is also a screen shot of Header and Body response.

Is there anything that I am doing wrong?

0 Kudos
Message 1 of 5
(803 Views)

The obvious question would be if the SQL query actually returns any data or just an empty array?

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(771 Views)
  • Here is the data returned by the SQL Query VI. See attached PNGs
  • The data shown is already converted to JSON as per block diagram indicator.
  • That data comes up as just  { } on the Web service client VI.

If I use a STRING indicator for result, and place it on the connector pane, I do get all the data but the format is messed up with ESCAPE characters and such.

 

Anthony

 

 

0 Kudos
Message 3 of 5
(761 Views)
Spoiler
Attached is the LabVIEW web service project files.

1. The Web Service Project
2. HTTP LabVIEW Client to access that Web Service

I see this error coming from the WRITE RESPONSE VI:

NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi<APPEND>
0 Kudos
Message 4 of 5
(716 Views)
Solution
Accepted by topic author Anthony_L

OK, that error is now resolved!

 

The reason why it was happening was because, if you send anything via the WRITE RESPONSE Web Service VI as an output, you MUST set the METHOD VI Property to STREAM.

 

See setting in attached PNG.

0 Kudos
Message 5 of 5
(691 Views)