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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:15:38+00:00 2026-05-25T20:15:38+00:00

Converting JSON to Java The above question is with reference to what has been

  • 0

Converting JSON to Java

The above question is with reference to what has been described on the above thread. There are so many API(s) which provide the flexibility to return responses either in XML or JSON. **I would like to know if there is a way to automatically construct the java bean corresponding to a JSON response. **

  • 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-25T20:15:39+00:00Added an answer on May 25, 2026 at 8:15 pm

    lets say you get an object like

        [
            {
            "name":"Java 6 Greatest Hits",
            "Author":"Jim Bob Jones",
            "price":10.25
            },
            {
            "name":"How to raise a goat",
            "Author":"Sir Paxton",
            "price":55.97   
            },
            {
            "name":"Snow - It is cold",
            "Author":"Dr. White",
            "price":9.99    
            }
       ]
    

    And you want a class like

    public class Book{
        private String author;
        private String name;
        private Number price
    }
    

    with getters and setters
    One option is to use a service like JSONGen, which will create that class. You need to use it first, and include the generated code in your project.
    Another option could be dynamically generate the class using javassist or CGLib, but that class would be useless unless you use reflection to access its members, so even if it would be a class, it will behave like a really annoying Map. In no way will be better that simple using JSONObject

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

Sidebar

Related Questions

I have been looking around for examples related to converting JSON strings to Java
Duplicate: Converting HTML TAG Object to JSON Object Hi, Is there is any Javascript
I found many things about converting Groovy to JSON, but oddly enough, not the
Spring MVC + Jackson converting Java object to/from Json data. I want to validate
Possible Duplicate: Converting XML to JSON using Python? I am importing an XML feed
Possible Duplicate: Converting XML to JSON using Python? I'm doing some work on App
What is the best way of converting a multi-dimensional javascript array to JSON?
When converting a project (in which a template method of IComparable was used a
I am converting from existing CVS repository to SVN repository. CVS repository has few
I'm converting an application to use Java 1.5 and have found the following method:

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.