go-simplejson
go-simplejson copied to clipboard
no way to change jsonObj.MustArray()[i] to *simplejson.Json
I want to iterate an array, and use the elements of the array as *simplejson.Json. I found no function to get size of array, the only way I found is to calculate len(jsonObj.Array), and I have no way to change jsonObj.MustArray()[i] to *simplejson.Json.
Can you not do this?
arr := jsonObj.MustArray()
for i := 0; i < len(arr); i++ {
j := &simplejson.Json{data: arr[i]}
// use j which is *simplejson.Json
}
Can you not do this?
arr := jsonObj.MustArray() for i := 0; i < len(arr); i++ { j := &simplejson.Json{data: arr[i]} // use j which is *simplejson.Json }
The 'data' is private so can not unfortunately.
We true need a method like JSONArray() []*simplejson.Json