Yuck... this smells like the API's wrong.  Surely it should be something like:

    [ { public_id: "<blah>", private_ids: [ "<blah>", "<blah>",...] }, ... ]

Then you can get values the sensible way.