antonholmquist / jason

Easy-to-use JSON Library for Go

Home Page:http://godoc.org/github.com/antonholmquist/jason

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Highly nested Json

ehmo opened this issue · comments

Hi,

I've a highly nested Json that I want to iterate through. Here is an example.

[{"a":[{"3":5},{"2":3},{"b":[{"n":2},{"b":"c"},{"c":[{"d":1},{"u":2}]}]}]},{"a":[{"3":5},{"2":3},{"b":[{"n":2},{"b":"c"},{"c":[{"d":1},{"f":[[2,3,4,{"tik":1}],3,5]}]}]}]},{"a":[{"3":5},{"2":3},{"b":[{"n":2},{"b":"c"},{"c":[{"d":1},{"i":2}]}]}]}]

Ho do I get to the tik key?

Also probably an unrelated question, is there a way how to search this highly nested Json based on key or value?

Thank you

commented

@ehmo

Hi, ehmo!!

Do you remember this issue?
I've just finished to support this issue on my forked repo.

You can find your "tik" key.
https://github.com/aimof/jason/blob/fbb734d7ff248e01beea369ac2cc01b945c185aa/jason_highly_nested_test.go#L69
https://github.com/aimof/jason/blob/fbb734d7ff248e01beea369ac2cc01b945c185aa/jason_highly_nested_test.go#L120

Please check my srouce code.
The way of parsing is changed but it has compatibility.

Thank you.