Jump to content

g.e help


Recommended Posts

Posted

How do you  write json parser without reflection, create new java calls for each json data class structure?

Parsing without reflection means you have to know the structure of the JSON. All you have to do if read the document and interpret it as fields and values

 

{ "item": { "name":"Cannonball", "id":2, "price":340 } }

 

translates into

public class Item {

    private String name;
    private Integer id;
    private Integer price;

}

So you can read the page into a string, get rid of "item":  { } and " ", split by , and you will have field:value pairs which you can insert into your Item instances 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...