some little explanations about the json parser.
First of all, it's not a real parser but more a "finder" instructed to follow JSON rules !
It find, in the order, all the terms specified separated by the "." (point).
Let's see with an example with OpenWeatherAPI :
the query is :
let appid = "YOUR APPID"
let query = "http://api.openweathermap.org/data/2.5/weather?&units=metric&q=Miami,us&appid=" & appid
let ret = wget(query)
serialprintln ret
---------------------------------------------------------------
{"coord":{"lon":-80.19,"lat":25.77},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"base":"cmc stations","main":{"temp":23.38,"pressure":1031.39,"humidity":65,"temp_min":23.38,"temp_max":23.38,"sea_level":1031.65,"grnd_level":1031.39},"wind":{"speed":2.97,"deg":123.001},"clouds":{"all":36},"dt":1456871476,"sys":{"message":0.0101,"country":"US","sunrise":1456832554,"sunset":1456874597},"id":4164138,"name":"Miami","cod":200}
Now you can find any element as follow :
let desc = json(ret,"weather.description")
let temp = json(ret,"main.temp")
let press = json(ret,"main.pressure")
let humid = json(ret,"main.humidity")
let tim = json(ret,"dt") ' this is the time
let tim = unixtime(tim) ' this function converts the time from the unix format to "standard format";
let name = json(ret,"sys.name")
Now there is another function dedicated to OpenWeatherApi but more for the forecast.
As the forecast messages can be very big and cause the saturation of the ESP memory (with the associated crash), there is another function that permit to "filter" the message.
For example, this query generate a very long message (around 15 Kb):
let query = "http://api.openweathermap.org/data/2.5/forecast?&units=metric&q=Miami,us&appid=" & appid
So, there is another function that able to choose one item from the list; this is extracted from the stream with a minimum use of the memory.
Example :
let query = "http://api.openweathermap.org/data/2.5/forecast/daily?&units=metric&q=Miami,us&appid=" & appid
let ret = readopenweather(query,1) ' the 1 means the first item of the list - 0 means the root
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
serialprint tim
If you need another item from the list, simply repeat the request using another index.
Regards,
CiccioCB