Jump to content

g.e help

Recommended Posts

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 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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