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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:03:05+00:00 2026-06-14T14:03:05+00:00

I am using Jersey to parse the following JSON: {response:{status:OK,campaigns:[{id:12345,state:active,code:null}]}} But I get the

  • 0

I am using Jersey to parse the following JSON:

{"response":{"status":"OK","campaigns":[{"id":12345,"state":"active","code":null}]}}

But I get the following error message:

java.lang.IllegalArgumentException: No more parsing elements.

If I switch the position of the fields code and state so that the resulting JSON looks like

{"response":{"status":"OK","campaigns":[{"id":12345,"code":null,"state":"active"}]}}

everything works fine. Also if I change the code-field in the first JSON to a non-null value like "code":"test", Jersey can parse this without any problems. I tried other more complex examples always getting the above mentioned error message when leaving the last field of any element of an array null.

I think I am doing something wrong, because I could not find any others having the similar problem. I already tried to implement a CustomJAXBContextResolver using other JSON notations like natural but nothing worked for me.

Any ideas?


Here are my binding classes:

@XmlRootElement
public class LoadEntityResponse {

public LoadEntityResponse() {
}

private Response response;

public Response getResponse() {
    return response;
}

public void setResponse(Response response) {
    this.response = response;
}
}

and

public class Response {

public Response() {
}

private String status;
private String error;
private String error_id;

private Campaign[] campaigns;

public String getStatus() {
    return status;
}

public void setStatus(String status) {
    this.status = status;
}

public String getError() {
    return error;
}

public void setError(String error) {
    this.error = error;
}

public String getError_id() {
    return error_id;
}

public void setError_id(String error_id) {
    this.error_id = error_id;
}

public Campaign[] getCampaigns() {
    return campaigns;
}

public void setCampaigns(Campaign[] campaigns) {
    this.campaigns = campaigns;
}
}

and finally

public class Campaign{
public Campaign() {
}

protected int id;
protected String code;
protected String state;

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public String getCode() {
    return code;
}

public void setCode(String code) {
    this.code = code;
}

public String getState() {
    return state;
}

public void setState(String state) {
    this.state = state;
}
}

Solved: Using JacksonJsonProvider now:

...
DefaultClientConfig config = new DefaultClientConfig();
config.getClasses().add(JacksonJsonProvider.class);
...

that´s all!

  • 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-14T14:03:07+00:00Added an answer on June 14, 2026 at 2:03 pm

    You can also use Jackson POJO support that comes with jersey-json but there is a need to do some configuration, see POJO support in Jersey User Guide.

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

Sidebar

Related Questions

I am using Jersey v10 and have written the following code.Is this the right
Using Jersey/JAX-RS I have a get handler that contains code to copy a large
My service side code is implemented using Resteasy @GET @Path(/ad-details/{query}) @Produces(application/json) public String getAdDetails(@PathParam(query)
Using Jersey, I want to be able to have a GET request, that would
How do I send GET requests using the Jersey Client API to a server
I'm using Jersey (jax-rs), to build a REST rich application. Everything is great, but
I'm trying to implement REST API using Jersey with Spring on Tomcat but I'm
JSON is created in Java using Jersey's JAXB serializer. I need to deserialize it
Using Jersey and Jackson to create a REST interface, how do I get List
I am using Jersey JAX-RS. I want to return a Response with a Map

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.