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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:42:39+00:00 2026-05-30T03:42:39+00:00

JSON is created in Java using Jersey’s JAXB serializer. I need to deserialize it

  • 0

JSON is created in Java using Jersey’s JAXB serializer.
I need to deserialize it in .NET application.
The problem is in serialized arrays:
if array contains several items JSON object is like that:

{"users":[{"name":"user1", "email":"user1@email.com"},{"name":"user2", "email":"user2@email.com"}]}

but when object contains only one item it is serialized as a simple object

{"users":{"name":"user1", "email":"user1@email.com"}}

I want to deserialize it into .NET object.

public class UserList{
   public List<User> users {get;set;}
}
public class User{
   public string name {get;set;}
   public string email {get;set;}
}

Standard .NET deserializer does not understand the second case. I tried JSON.NET default deserializer but it throws exception. Maybe it needs to be configured properly?..
Can you suggest something how to deal with first and second cases.
P.S. I have no access to the Java serializer

  • 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-30T03:42:42+00:00Added an answer on May 30, 2026 at 3:42 am

    In Json.Net, you can create a custom converter that can handle JSON like this.

    Have a look at Deserializing JSON when sometimes array and sometimes object on how exactly to do that.

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

Sidebar

Related Questions

I am working with a java Twitter app (using Twitter4J api). I have created
I am using GSON to parse a Java bean and pass the JSON string
I'm using JSON with Gson package for java. I have an object where there
I want to deserialize a JSON object (using GSON, because I already use it
item is json serialized not binary so it is readable. I am getting problem
I am using Mongodb Java driver for my Java client application. it needs to
I am using gson to parse json into java beans. For the API I
In my Blackberry application I am loading JSON using the following method. private static
My service side code is implemented using Resteasy @GET @Path(/ad-details/{query}) @Produces(application/json) public String getAdDetails(@PathParam(query)
I have a small test application I'm writing in Java to parse some JSON

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.