0

In the below JSON object I want to parse without knowing key name. object also contains another object within it.

{"status":"ok","description":"Request was successful.","account":{"renewal_upper_limit":0,"id":10066,"email":"raj@gmail.com","full_name":" Raj","phone":"99000000","format_time":"America","format_date":"Asia","reports_time_range":"24 hours","dashboard_time_range":"24H"}}

user2709752
  • 488
  • 6
  • 26

1 Answers1

2

Json Object is just like a Map, you can iterate it like this:

    JSONObject parse = JSON.parseObject("");
    for (Map.Entry<String, Object> entry : parse.entrySet()) {
        System.out.println(entry.getKey() + "=" + entry.getValue());
    }

fastjson is available here:https://github.com/alibaba/fastjson

lichengwu
  • 4,277
  • 6
  • 29
  • 42