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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:20:12+00:00 2026-06-06T00:20:12+00:00

Id like to represent a Class object as JSON. For example, if I have

  • 0

Id like to represent a Class object as JSON. For example, if I have the class defintions as follows:

public class MyClass {
    String myName;
    int myAge;
    MyOtherClass other;
}

public class MyOtherClass {
    double myDouble;
}

I’d like to get the following nested JSON from a Class object of type MyClass:

{
   myName: String,
   myAge: int,
   other: {
      myDouble: double;
   }
}

EDIT:

I don’t want to serialize instances of these classes, I understand how to do that with GSON. I want to serialize the structure of the class itself, so that given a proprietary class Object I can generate JSON that breaks down the fields of the class recursively into standard objects like String, Double, etc.

  • 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-06T00:20:16+00:00Added an answer on June 6, 2026 at 12:20 am

    I would recommend to use Jackson.
    You can also take a look at the JSonObjectSerializer class based on Jackson which can be found at oVirt under engine/backend/manager/module/utils (you can git clone the code) and see how we used Jackson there.

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

Sidebar

Related Questions

I have a complex JSON object that I want represent as C# class. I
For example in classic object oriented programming I might have a class School which
Imagine I have a class used to represent some trivial numerical data, like a
For example I have next Domain class User{ String name } Also I have
I have a terrain map which i would like to represent some data in.
I have to represent graphically an oriented graph like in the image below. alt
Excel 2003 Question: I'd like to have one cell represent a range of cells.
I have an array of integers which represent a RGB image and would like
I have 2 questions: Why is this possible for an int variable: foo.h: class
class MyThing { protected HashMap<String,Object> fields; protected MyThing(HashMap<String,Object> newFields){ fields.putAll(newFields); } protected Object get(String

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.