Json array decoding
hubert last edited by
I'm looking for a way to decode a JSON response from HTTP2 block.
I need to decode a JSON array: one of the json fields value is an array.
I tried first decode JSON to string, one of the field is an json array - so I connected another JSON-decode block. PJSOCT output -> PJROCT jtxt input
Unfortunately block is in error state:
103 General input variable error
But I think there is no output from the PJSOCT block - what is expected behaviour in such case?
thank you for your question. It would be much more easier to answer if you can share project files which shows the example of such JSON string and function block settings.
If you want to access JSON array, just use "[x]" notation, i.e. weather.main (means field "main" in 1st item of "weather" array) - see "0302-04 OpenWeatherMap API" example.
Hope it helps.