It seems completely funny but I am actually trying to get through this for the last 2 days:
I try to access weather data through the OpenWeatherMap.org API wich seems to work fine with internet.request(url).
The problem is just that it returns me the JSON as a table instead of a String. I tried to access fields of that table but everything seems to return nil. I just can't get to access anything from that table. There are tons of JSON serialization librarys out there but they all need the JSON as a String. I am completely lost rn.
This is the API response that gets stored as a table for some reason:
local web = require("internet")local data = web.request(<API_LINK>)-- data is of type table and I don't know how to get any values. Tried so many combinations on indices.-- For each loop works to loop through everything though
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
It seems completely funny but I am actually trying to get through this for the last 2 days:
I try to access weather data through the OpenWeatherMap.org API wich seems to work fine with internet.request(url).
The problem is just that it returns me the JSON as a table instead of a String. I tried to access fields of that table but everything seems to return nil. I just can't get to access anything from that table. There are tons of JSON serialization librarys out there but they all need the JSON as a String. I am completely lost rn.
This is the API response that gets stored as a table for some reason:
My Lua code couldn't be simpler:
Link to post
Share on other sites