Not sure exactly what you are trying to do. JSONSerializer allows you to 
deserialize a JSON array into a typed ArrayList (for example, ArrayList<Foo>). 
You don't need to use an array for this purpose.

FWIW, deserializing an array will be more performance-intensive than an array 
list, since the length of the array won't be known until it is completely read. 
Internally, we'd need to use an array list to build the list, then call 
toArray() on it to copy its contents into an array. Doesn't seem worth the 
effort.


On Nov 22, 2010, at 6:24 PM, Bill van Melle wrote:

> More about my bonus question -- this would be a good reason for the JSON 
> deserializer to be able to create Java arrays, not just ArrayLists.  That's 
> because I can say Foo[].class, but I can't say ArrayList<Foo>.class.  And 
> unfortunately, if I try Foo[].class, Pivot reports this runtime error:
> 
>     java.lang.RuntimeException: java.lang.InstantiationException: 
> [Lcom.fxpal.myunity.Foo;
> 
> which is consistent with the earlier errors.
> 
> I notice that GSon claims to be able to deserialize to a Java array.  They 
> also have a kludgy workaround for specifying the "class" of an ArrayList<>.  
> The kludge doesn't work in Pivot, though (at least not in the most naive way, 
> of including their library and using their syntax).

Reply via email to