I need to make a get request and retrieve data from a json array, but I don't know how to fetch a specific array index and print its value. There doesn't seem to be any information online about it either.
local curl = require("lcurl")
c = curl.easy{
url = 'http://example.com/api/?key=1234',
httpheader = {
"Content-Type: application/json";
};
writefunction = io.stderr
}
c:perform()
c:close()
This returns
[
{
"id": "1",
"name": "admin"
}
]
But how can I make it print only the value of name?