Can I evaluate an Http request with a Json response?
How do I do that? how start the request, with button?
I get this answer by test a result:
OK:{"sensors":[
{"ID":"In1","Disp":0,"P1":0,"P2":0,"Val":0.01,"Min":0,"Max":0,"U":"kg"}
]}
I would like to have "Val":
Must i make a json to variable Converter with var in Emulator?
is a sample on youtube?
Hi,
go to the "Http Request" settings.
Select:
input emulator V0 (The request will be executed every time the V0==1)
Output emulator V1 (This variable will store the http json request)
Add the script "Json to variable converter". Go to the settings:
Input emulator V1
Output emulator V2
Value json path: Val
Save
Add a button for emulator V0
Add a "Value display" for V1
Add a "Value display" for V2
Reload the project to restart the emulator
Click on the button to set the V0 to 1
The request will be executed
The http response will be stored in the variable V1
The converter will extract the value of the field Val to V2
You have to see the results to the value displays.
I have tested. It works fine
(09-07-2023, 10:38 PM)iliaslamprou Wrote: [ -> ]Hi,
go to the "Http Request" settings.
Select:
input emulator V0 (The request will be executed every time the V0==1)
Output emulator V1 (This variable will store the http json request)
Add the script "Json to variable converter". Go to the settings:
Input emulator V1
Output emulator V2
Value json path: Val
Save
Add a button for emulator V0
Add a "Value display" for V1
Add a "Value display" for V2
Reload the project to restart the emulator
Click on the button to set the V0 to 1
The request will be executed
The http response will be stored in the variable V1
The converter will extract the value of the field Val to V2
You have to see the results to the value displays.
I have tested. It works fine
Unfortunately it doesn't work, I already had the result, the variable I'm looking for this "Val"
It must have something to do with the square brackets.
I send you per Email my attatch png
in the png is attached are my results for Val and sensors in the lower field
Hi,
the value is inside a json that is the first item of a list.
The list is the value of the "sensors".
Use this syntax
sensors[0]/Val
I have tested and works fine
You are the best,
only your tip, never found this :-(
Thankyou