This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes Coping with differing Json object names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Coping with differing Json object names" Watch "Coping with differing Json object names" New topic
Author

Coping with differing Json object names

M Bryan
Ranch Hand

Joined: Jun 15, 2011
Posts: 64
Hi,

from a website I am getting a request in json format. It roughly looks like this:



Usually, I would write something like jsonObject.getAsJsonObject("343153"), but this does not work in this case, since the IDs differ.
How can I extract that two entries into something like a list?

Thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61090
    
  66

It might help to mention which JSON library you are using.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M Bryan
Ranch Hand

Joined: Jun 15, 2011
Posts: 64
Google gson
M Bryan
Ranch Hand

Joined: Jun 15, 2011
Posts: 64
Okay I found it out: jo.entrySet();
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coping with differing Json object names