Q:

Deserialize JSON Root Array

I'm having so trouble deserializing a JSON stream that contains an array as the root:
[
    {
        "object": {
                     "property1":"000000",
                     "property2":"000000"
                  }
    },
    {
        "object": {
                     "property1":"000000",
                     "property2":"000000"
                  }
    }
]

I tried using JSON.deserializeUntyped and assigning to a Map, but I keep getting a "invalid conversion runtime type LIST to MAP". This method worked fine when I was dealing with single JSON objects, but loading multiples into an array trips this error. Should I be using a different type for deserialization?

A:

You have to cast it into a List<Object>, and for each element in the list, you can access the values as a Map<Object,Object>. 

