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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:32:32+00:00 2026-06-07T03:32:32+00:00

I want to parse a json data into a java object, then post it

  • 0

I want to parse a json data into a java object, then post it to a .jsp to then turn it back into a json object so I can put it into a javascript array.

Here is an example of the data I want to parse:

"LoanList" = [ {"Loan" : "One","Lat" : "35.65365", "Lng" : "123.1331" , "Bal" : "4565" ,  "Address" : "Address 1" , "Delinquency" : "True')]

After reading about it, I decided to use gson to parse the data: After reading other questions about this topic, I wrote two classes.

class1.java

import java.util.ArrayList;

public class JSON1 {

    ArrayList<innerData> Loanlst;


    public ArrayList<innerData> getLoanlst() {
        return Loanlst;
    }
    public void setLoanlst(ArrayList<innerData> Loanlst) {
        this.Loanlst = Loanlst;
    }
}

class2.java

import java.math.*;

public class innerData {
public String loan;
public BigDecimal lat;
public BigDecimal lng;
public BigDecimal bal;
public String addrs;
public String delinq;

public String getLoan() {
    return loan;
}

public void setLoan(String loan){
    this.loan = loan;
}

public BigDecimal getLat() {
    return lat;
}

public void setLat(BigDecimal lat){
    this.lat = lat;
}

public BigDecimal getLng() {
    return lng;
}

public void setLng(BigDecimal lng){
    this.lng = lng;
}

public BigDecimal getBal() {
    return bal;
}

public void setBal(BigDecimal bal){
    this.bal = bal;
}

public String getAddrs() {
    return addrs;
}

public void setAddrs(String addrs){
    this.addrs = addrs;
}


public String getDelinq() {
    return delinq;
}

public void setDelinq(String delinq){
    this.delinq = delinq;
}
}

Here is where I am stuck, Where do I create my new Gson() to parse the data before I send it?

  • 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-07T03:32:34+00:00Added an answer on June 7, 2026 at 3:32 am

    Using your class you should be able to do something like:

    InnerData obj = new InnerData(...);//fill in with data
    Gson gson = new Gson();
    
    // convert java object to JSON format,
    // and returned as JSON formatted string
    String json = gson.toJson(obj);
    

    check an example here and here

    Tip: try creating a main class to run it separately.

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

Sidebar

Related Questions

I want a method that extracts the data from a JSON-object parsed before as
I am getting json data as a response back from the server. I want
I want to parse some JSON data. I'm using James Newton-King's JSON.NET library .
I have about 7000 lines of JSON data that I want to parse. An
I want to convert string from koderesult into object, and then thie obj.result should
How can I parse this into an eval object with json2 dot js? There
I want to parse this Json code : [{id:7,key:integrationContinue:integrationContinue,name:life Portlet,scope:PRJ,qualifier:TRK,date:2012-03-26T10:10:22+0100,lname:life Portlet,lang:java,version:1.0-SNAPSHOT,description:,msr:[{key:ncloc,val:897.0,frmt_val:897},{key:coverage,val:0.6,frmt_val:0,6%}]}] I created two
I want to deserialize a JSON object (using GSON, because I already use it
I'm looking for a JSON parser and encoder for .NET that can parse JSON
I have a question with respect to putting JSON data into a table view.

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.