0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
sayvortana
  • 825
  • 2
  • 16
  • 32

1 Answers1

1

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)

Community
  • 1
  • 1
Justin Shield
  • 2,390
  • 16
  • 12