Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 9 months ago.
parse json
hello, through a webservice I receive , after a get request , the json .
{"coord":{"lon":7.28,"lat":43.7},"sys":{"type":3,"id":61624,"message":0.2379,"country":"France","sunrise":1427433653,"sunset":1427478691},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}],"base":"cmc stations","main":{"temp":292.21,"humidity":67.44,"pressure":1005.96,"temp_min":289.84,"temp_max":295.37},"wind":{"speed":2.41,"deg":359.001},"rain":{"3h":0},"clouds":{"all":0},"dt":1427457594,"id":2990440,"name":"Nice","cod":200}
But the trouble is that I would recover for example only the value of Temp ... How could I do? thank you in advance.
the json is include in a char variable.
please help me, it's a works for tomorrow !! I need your help
1 Answer
9 years, 9 months ago.
Since you need only the temperature ("temp" in the provided JSON), you could probably tokenize the string by using strtok. See the following http://www.cplusplus.com/reference/cstring/strtok/