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 8951251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:37:14+00:00 2026-06-15T13:37:14+00:00

Exception: **org.springframework.http.converter.HttpMessageNotReadableExeption: Could not read JSON:java.lang.IllegalStateExeption: Exepted BEGIN_ARRAY but was BEGIN_OBJECT at line 1

  • 0

Exception:

**org.springframework.http.converter.HttpMessageNotReadableExeption:
Could not read JSON:java.lang.IllegalStateExeption:
Exepted BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2;
nested exception in com.google.gson.JsonSyntaxException:java**

JSON:

{
    "objects": [
        {
            "id": "1",
            "category": "category1"
        },
        {
            "id": "2",
            "category": "category2"
        }
    ]
}

API Call:

HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAccept(Collections.singletonList(new MediaType("application", "json")));

HttpEntity << ? > requestEntity = new HttpEntity < Object > (requestHeaders);
GsonHttpMessageConverter messageConverter = new GsonHttpMessageConverter();
List < HttpMessageConverter << ? >> messageConverters = new ArrayList < HttpMessageConverter << ? >> ();

messageConverters.add(messageConverter);
RestTemplate restTemplate = new RestTemplate();

restTemplate.getMessageConverters().add(messageConverter);
restTemplate.getMessageConverters().add(new org.springframework.http.converter.json.GsonHttpMessageConverter());

ResponseEntity < Category[] > responseEntity = restTemplate.exchange(url, HttpMethod.GET, requestEntity, Category[].class);
Category[] response = responseEntity.getBody();

Model class:

public class Category {

     private Integer id;
     private String category;

     public Category() {}

     public Integer getId() {
         return id;
     }
     public void setId(Integer newId) {
         this.id = newId;
     }

     public String getCategory() {
         return category;
     }

     public void setCategory(String category) {
         this.category = category;
     }
 }

Logcat:

12-07 02:55:21.123: E/Trace(1043): error opening trace file: No such file or directory (2)
12-07 02:55:22.693: D/libEGL(1043): loaded /system/lib/egl/libEGL_emulation.so
12-07 02:55:22.702: D/(1043): HostConnection::get() New Host Connection established 0x2a0d9c80, tid 1043
12-07 02:55:22.723: D/libEGL(1043): loaded /system/lib/egl/libGLESv1_CM_emulation.so
12-07 02:55:22.754: D/libEGL(1043): loaded /system/lib/egl/libGLESv2_emulation.so
12-07 02:55:22.903: W/EGL_emulation(1043): eglSurfaceAttrib not implemented
12-07 02:55:22.963: D/OpenGLRenderer(1043): Enabling debug mode 0
12-07 02:55:23.363: D/dalvikvm(1043): GC_CONCURRENT freed 231K, 6% free 6196K/6535K, paused 76ms+41ms, total 284ms
12-07 02:57:16.873: W/EGL_emulation(1043): eglSurfaceAttrib not implemented 12-07 02:57:20.872: D/dalvikvm(1043): null clazz in OP_INSTANCE_OF, single-stepping
  • 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-06-15T13:37:15+00:00Added an answer on June 15, 2026 at 1:37 pm

    Try this,
    so your result is an array, and not a json object.

    [
        {
            "id": "1",
            "kategorija": "kategorija1"
        },
        {
            "id": "2",
            "kategorija": "kategorija2"
        }
    ]
    

    That way you’ll receive an Array of json objects and not a json object with an array.

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

Sidebar

Related Questions

Exception in thread Thread-0 java.lang.NullPointerException at org.apache.http.impl.nio.reactor.AbstractIOReactor.closeActiveChannels(AbstractIOReactor.java:532) at org.apache.http.impl.nio.reactor.AbstractIOReactor.hardShutdown(AbstractIOReactor.java:564) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.doShutdown(AbstractMultiworkerIOReactor.java:411) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:340) at
I am tring to send mail by AWSCredentials but getting an exception java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory
When starting WebSphere, I get this exception: Could not instantiate bean class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]: Constructor
<oxm:jaxb2-marshaller id=marshaller> <oxm:class-to-be-bound name=myclass/> </oxm:jaxb2-marshaller> I keep getting exception: java.lang.NoSuchMethodError: org.springframework.http.MediaType.sortBySpecificity(Ljava/util/List;)V What is the
Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
06-26 17:07:09.898: E/AndroidRuntime(380): FATAL EXCEPTION: main 06-26 17:07:09.898: E/AndroidRuntime(380): java.lang.NoClassDefFoundError: org.mythrii.email.Mail 06-26 17:07:09.898: E/AndroidRuntime(380):
I've been trying to fix this error: {exception:Persistent class \Class org.myapp.model.Account does not seem
Command : \eclipse-SDK-4.2RC3-win32-x86_64_001\eclipse\plugins>java -jar org.eclipse.osgi_3.8.0.v20120529-1548.jar -console Exception (from Log files) !SESSION 2012-06-22 23:36:27.649 -----------------------------------------------
Here is the context for Spring Batch: <beans:beans xmlns:beans=http://www.springframework.org/schema/beans xmlns:b=http://www.springframework.org/schema/batch xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
While migrating a legacy application to spring security I got the following exception: org.springframework.beans.factory.BeanCreationException:

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.