SmartDroidDeveloper / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Ability to parse a JSON HttpResult containing an Array of objects #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

Discussion Thread 
http://groups.google.com/group/google-api-java-client/browse_thread/thread/73945
dc17855052e

Example API
http://dev.twitter.com/doc/get/users/search

Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.2, or All)?

All

Please describe the feature requested.

Currently the api client cannot parse an HttpResponse formatted as a JSON array 
of objects.

ie: [{"prop1":"val1","prop2":"val2"},{"prop1":"val1","prop2":"val2"}] 

Attempting to parse using parseAs(class) generates an IllegalArgumentException:

Exception in thread "main" java.lang.IllegalArgumentException: START_ARRAY at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java: 
88) 

Note that parseAsString() does work properly but the call 
Feed resp = response.parseAs(Feed.class); 
Should properly parse and return a feed object.

Original issue reported on code.google.com by ddamo...@gmail.com on 21 May 2011 at 5:35