This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

[?] table name LUA
#1
hi

is there any chance to read JSON names with numbers such as

"102010029"

i want to fetch content from DWD (german weather service)

there is also an isue within openweathermap. Rain forecast "3h" coulndt be used.

i hope aim is clear.

Best
Reply
#2
Can you post an example JSON data?
Reply
#3
openweathermap

{"cod":"200","message":0.007,"cnt":4,"list":[{"dt":1558386000,"main":{"temp":14.3,"temp_min":14.3,"temp_max":15.5,"pressure":1001.47,"sea_level":1001.47,"grnd_level":996.74,"humidity":92,"temp_kf":-1.2},"weather":[{"id":500,"main":"Rain","description":"Leichter Regen","icon":"10n"}],"clouds":{"all":65},"wind":{"speed":3.01,"deg":103.039},"rain":{"3h":0.188},"sys":{"pod":"n"},"dt_txt":"2019-05-20 21:00:00"},{"dt":1558396800,"main":{"temp":12.75,"temp_min":12.75,"temp_max":13.65,"pressure":1001.89,"sea_level":1001.89,"grnd_level":997.71,"humidity":92,"temp_kf":-0.9},"weather":[{"id":803,"main":"Clouds","description":"Überwiegend bewölkt","icon":"04n"}],"clouds":{"all":53},"wind":{"speed":2.77,"deg":108.402},"rain":{},"sys":{"pod":"n"},"dt_txt":"2019-05-21 00:00:00"},{"dt":1558407600,"main":{"temp":11.96,"temp_min":11.96,"temp_max":12.56,"pressure":1002.67,"sea_level":1002.67,"grnd_level":998.5,"humidity":93,"temp_kf":-0.6},"weather":[{"id":801,"main":"Clouds","description":"Ein paar Wolken","icon":"02n"}],"clouds":{"all":21},"wind":{"speed":2.53,"deg":85.688},"sys":{"pod":"n"},"dt_txt":"2019-05-21 03:00:00"},{"dt":1558418400,"main":{"temp":15.45,"temp_min":15.45,"temp_max":15.75,"pressure":1003.2,"sea_level":1003.2,"grnd_level":999.07,"humidity":83,"temp_kf":-0.3},"weather":[{"id":801,"main":"Clouds","description":"Ein paar Wolken","icon":"02d"}],"clouds":{"all":12},"wind":{"speed":3.05,"deg":96.72},"sys":{"pod":"d"},"dt_txt":"2019-05-21 06:00:00"}],....

DWD

"112063000":[{"end":1558379700000,"regionName":"Kreis Havelland","start":1558377900000,"type":0,"state":"Brandenburg","level":2,"headline":"Amtliche WARNUNG vor GEWITTER","description":"Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten bis 60 km/h (17m/s, 33kn, Bft 7).","stateShort":"BB","instruction":"ACHTUNG! Hinweis auf mögliche Gefahren: Örtlich kann es Blitzschlag geben. Bei Blitzschlag besteht Lebensgefahr!","altitudeStart":null,"altitudeEnd":null,"event":"GEWITTER"}],
Reply
#4
Example:

Code:
require('json')

data = '{"112063000":[{"end":1558379700000,"regionName":"Kreis Havelland","start":1558377900000,"type":0,"state":"Brandenburg","level":2,"headline":"Amtliche WARNUNG vor GEWITTER","description":"Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten bis 60 km/h (17m/s, 33kn, Bft 7).","stateShort":"BB","instruction":"ACHTUNG! Hinweis auf mögliche Gefahren: Örtlich kann es Blitzschlag geben. Bei Blitzschlag besteht Lebensgefahr!","altitudeStart":null,"altitudeEnd":null,"event":"GEWITTER"}]}'

decoded = json.decode(data)
log(decoded['112063000'][1])
Reply
#5
(21.05.2019, 06:12)admin Wrote: Example:

Code:
require('json')

data = '{"112063000":[{"end":1558379700000,"regionName":"Kreis Havelland","start":1558377900000,"type":0,"state":"Brandenburg","level":2,"headline":"Amtliche WARNUNG vor GEWITTER","description":"Es treten Gewitter auf. Dabei gibt es Windböen mit Geschwindigkeiten bis 60 km/h (17m/s, 33kn, Bft 7).","stateShort":"BB","instruction":"ACHTUNG! Hinweis auf mögliche Gefahren: Örtlich kann es Blitzschlag geben. Bei Blitzschlag besteht Lebensgefahr!","altitudeStart":null,"altitudeEnd":null,"event":"GEWITTER"}]}'

decoded = json.decode(data)
log(decoded['112063000'][1])

thank. sorry I was not precize enought.

here is the JSON

https://www.dwd.de/DWD/warnungen/warnapp...nings.json

I would need to pick "112063000" out of it.

But I guess leading number is the problem as it is for "3h" is...

Best
Reply


Forum Jump: