Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:28:06+00:00 2026-05-28T08:28:06+00:00

Much like How to deserialize JSON file starting with an array in Jackson? I

  • 0

Much like How to deserialize JSON file starting with an array in Jackson? I have a JSON REST reply that looks like

[
  {
    something
  },
  {
    something
  },
  ...
]

Problem is that the array is toplevel. I tried calling com.google.api.client.http.json.JsonHttpParser as follows:

Something[] result = jsonParser.parse(response, Something[].class); //array cannot be instantiated: java.lang.IllegalArgumentException: unable to create new instance of class [L...; because it is an array

List<Something> result = jsonParser.parse(response, List.class); //interface cannot be instantiated: java.lang.IllegalArgumentException: unable to create new instance of class java.util.List because it is an interface and because it has no accessible default constructor

ArrayList<Something> result = jsonParser.parse(response, ArrayList.class); //throws IllegalArgumentException: START_ARRAY

where Something is my model class that should allow deserialization of an element. None of these alternatives work. The stacktrace on the last one is:

01-21 18:44:15.649: E/AndroidRuntime(3117): Caused by: java.lang.IllegalArgumentException: START_ARRAY
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.json.JsonParser.startParsingObject(JsonParser.java:161)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.json.JsonParser.parse(JsonParser.java:233)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.json.JsonParser.parse(JsonParser.java:224)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.json.JsonParser.parseAndClose(JsonParser.java:180)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.json.JsonParser.parseAndClose(JsonParser.java:120)
01-21 18:44:15.649: E/AndroidRuntime(3117):     at com.google.api.client.http.json.JsonHttpParser.parse(JsonHttpParser.java:62)

How should I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:28:07+00:00Added an answer on May 28, 2026 at 8:28 am

    The google-api-client 1.4.1 classes just seem to rely on creating new instances and only working with START_OBJECT, not START_ARRAY, in this area, meaning they don’t support toplevel arrays.

    I couldn’t workaround this and I solved it by updating everything to google-api-client 1.6.0, which is quite a large update and refactor effort.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a device that supports 4-color graphics (much like CGA in the old
I have a simple class in asp.net mvc that looks like this: public class
My XML file looks something like this: <MyXml> <Version> 9.3.2 </Version> <Resources> <Sets> <ItemCollection>
I currently have interfaces much like the following: interface IService { void Start(); IHandler
I'm coding an app that works much like Apple's Weather.app: There's a UIPageControl at
I have put together a script which is very much like the flickr photostream
I have something like the following in the header class MsgBase { public: unsigned
I am trying to deserialize a JSON string that was serialized by JSON.Net 4.0
Lets say you have various objects of arbitrary type that you would like to
Much like this: http://www.w3schools.com/PHP/php_file_upload.asp But I'd like to store the contents of the file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.