Fix compound arrays

Calling type_cast for array elements, which fixes serialization of int arrays from strings and compound arrays (for example, arrays of json objects).

Also fixes deserializing compound arrays (calling type_cast for deserialized element)