sayvortana
sayvortana

Reputation: 825

How to take data from json object...?

I just start working with JSON data.

[[[170, "kod", 148, 13, "2011-07-11T03:33:57Z", 11.68, 10.0, 1310373205707,     "2939393939"]], [{"announcement": {"post_by": null, "created_at": "2010-09-04T09:59:12Z", "announcement_category": null, "updated_at": "2010-09-04T09:59:12Z", "valid_till": "2010-09-04T09:59:00Z", "priority": null, "id": 3, "condtions": "", "message": "hello"}}]]

I want to get:

[170, "kod", 148, 13, "2011-07-11T03:33:57Z", 11.68, 10.0, 1310373205707, "0976741509"]

and

[{"announcement": {"post_by": null, "created_at": "2010-09-04T09:59:12Z", "announcement_category": null, "updated_at": "2010-09-04T09:59:12Z", "valid_till": "2010-09-04T09:59:00Z", "priority": null, "id": 3, "condtions": "", "message": "hello"}}]

in string

any idea?

Upvotes: 0

Views: 846

Answers (1)

Justin Shield
Justin Shield

Reputation: 2380

Existing libraries for parsing JSON for Android/Java

There's an excellent answer to this posted here:

I am surprised these have not been mentioned: but instead of using bare-bones rather manual process with json.org's little package, GSon and Jackson are much more convenient to use. So:

So you can actually bind to your own POJOs, not some half-assed tree nodes or Lists and Maps. (and at least Jackson allows binding to such things too (perhaps GSON as well, not sure), JsonNode, Map, List, if you really want these instead of 'real' objects)

Upvotes: 1

Related Questions