Hello Everybody,
I would like to parse a JSON http response and show only the values I'm interested in. I am trying with a!fromJson function but I am not able to get multiple values in the result body of the call integration to my webAPI.
I would really appreciate getting some help here please.
This is the Json that I receive. I would like to get some of the values from there and be able to filter those I'm interested in. Any ideas?
Gonzalo
Discussion posts and replies are publicly visible
What specifically happens when you call a!fromJson on the above json string? Any chance you can post it here as text instead of as a picture?
Hello,
Here is the json string as text:
{"coord":{"lon":-3.7,"lat":40.42},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"base":"stations","main":{"temp":297.85,"feels_like":296.53,"temp_min":296.15,"temp_max":299.15,"pressure":1026,"humidity":44},"visibility":10000,"wind":{"speed":2.6,"deg":120},"clouds":{"all":20},"dt":1590499496,"sys":{"type":1,"id":6443,"country":"ES","sunrise":1590468593,"sunset":1590521653},"timezone":7200,"id":3117735,"name":"Madrid","cod":200}
If I want to post in a read-only interface the "temp" and "pressure" value only for example, what expression/function should I use?
Calling a!fromJson on that string does return a valid dictionary of data. You should be able to refer to individual elements of the dictionary via standard dot notation in this case. In this case if you stored the result of the fromJson call in local!jsonDictionary, then you could get "temp" just by calling local!jsonDictionary.main.temp
Thank you very much for your answer Mike. And if I want to show various values? not only the "temp"?
You should be able to access any of the properties in the dictionary using dot notation in the same syntax.