Parsing JSON in Luan

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parsing JSON in Luan

Thermo
This post was updated on .
What would be a good way to approach parsing JSON in Luan?

I am extracting the price of gold from here:

https://query1.finance.yahoo.com/v7/finance/quote?symbols=GC=F

For now I am doing:

String.sub(res,String.find(res,"ask")+5,String.find(res,"bidSize")-3)

where res is the content of the yahoo url I posted. It works, but it will stop working if, for example, a new field is added between "ask" and "bidSize", so I am wondering if there is a built-in way to parse JSON in Luan.
Reply | Threaded
Open this post in threaded view
|

Re: Parsing JSON in Luan

fschmidt
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Parsing JSON in Luan

Thermo
Simple and it works, thanks.