dregenor / jsonMapper

simple json mapper
MIT License
31 stars 8 forks source link

Multidimensional arrays #11

Closed dyf182 closed 8 years ago

dyf182 commented 8 years ago

Hi,

Is there a way to map out a nested json array, so i can keep references of the child array to its parent while cycling through both?

I've tried using the map feature but within the second map the value passed doesn't seem to quite work.

given an example json:

{ "schools" : [ { "name" : "school a", "abbvr" : "AED", "students" : [ {"name" : "a"}, {"name" : "b"} ] }, { "name" : "school b", "abbvr" : "EG", "students" : [ {"name" : "c"}, {"name" : "d"} ] }, { "name" : "school c", "abbvr" : "ESA", "students" : [ {"name" : "e"}, {"name" : "f"} ] } ] }

The end goal being to cycle through each school and then cycle through each student as well.

Thanks

dregenor commented 8 years ago

check this https://gist.github.com/dregenor/fdb7cc19c1ab92469ac84bd1615e704a