VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.76k stars 568 forks source link

Complex json #194

Open gsasoftware opened 3 years ago

gsasoftware commented 3 years ago

In a json like that: {"chart":{"result":[{"meta":{"currency":"EUR","symbol":"0P0000CV2T.F","exchangeName":"FRA","instrumentType":"MUTUALFUND","firstTradeDate":1514876400,"regularMarketTime":1615492800,"gmtoffset":3600,"timezone":"CET","exchangeTimezoneName":"Europe/Berlin","regularMarketPrice":252.244,"chartPreviousClose":251.389,"priceHint":2,"currentTradingPeriod":{"pre":{"timezone":"CET","start":1615791600,"end":1615791600,"gmtoffset":3600},"regular":{"timezone":"CET","start":1615791600,"end":1615842000,"gmtoffset":3600},"post":{"timezone":"CET","start":1615842000,"end":1615842000,"gmtoffset":3600}},"dataGranularity":"1d","range":"","validRanges":["1mo","3mo","6mo","ytd","1y","2y","5y","10y","max"]},"timestamp":[1615359600,1615446000],"indicators":{"quote":[{"close":[251.3885955810547,252.243896484375],"high":[251.3885955810547,252.243896484375],"volume":[0,0],"low":[251.3885955810547,252.243896484375],"open":[251.3885955810547,252.243896484375]}],"adjclose":[{"adjclose":[251.3885955810547,252.243896484375]}]}}],"error":null} }

How can I get "close value".

I try json("chart")("result")("indicators")("quote")(1)("close")

Thanks

houghtonap commented 3 years ago

See my comments in issue #186.

aholden10 commented 3 years ago

The paths to the two 'close' values are:('chart')('result')0('quote')0[0] => 251.3885955810547('chart')('result')0('quote')0[1] => 252.243896484375 You've missed that many of the paths are actually within arrays...these cannot be ignored. Hope it helps.

On Monday, March 15, 2021, 07:20:36 AM EDT, Alberto ***@***.***> wrote:  

In a json like that: {"chart":{"result":[{"meta":{"currency":"EUR","symbol":"0P0000CV2T.F","exchangeName":"FRA","instrumentType":"MUTUALFUND","firstTradeDate":1514876400,"regularMarketTime":1615492800,"gmtoffset":3600,"timezone":"CET","exchangeTimezoneName":"Europe/Berlin","regularMarketPrice":252.244,"chartPreviousClose":251.389,"priceHint":2,"currentTradingPeriod":{"pre":{"timezone":"CET","start":1615791600,"end":1615791600,"gmtoffset":3600},"regular":{"timezone":"CET","start":1615791600,"end":1615842000,"gmtoffset":3600},"post":{"timezone":"CET","start":1615842000,"end":1615842000,"gmtoffset":3600}},"dataGranularity":"1d","range":"","validRanges":["1mo","3mo","6mo","ytd","1y","2y","5y","10y","max"]},"timestamp":[1615359600,1615446000],"indicators":{"quote":[{"close":[251.3885955810547,252.243896484375],"high":[251.3885955810547,252.243896484375],"volume":[0,0],"low":[251.3885955810547,252.243896484375],"open":[251.3885955810547,252.243896484375]}],"adjclose":[{"adjclose":[251.3885955810547,252.243896484375]}]}}],"error":null} }

How can I get "close value".

I try json("chart")("result")("indicators")("quote")(1)("close")

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Bearx2004 commented 3 years ago

json("chart")("result")(1)("indicators")("quote")(1)("close")(1)

or using "https://github.com/Bearx2004/vb6jsonx" JsonObject.Query("chart.result.(1).indicators.quote.(1).close.(1)")