0

I am using QuickBooks reports API and I want to convert the JSON reports to pdf and also do some modifications. Most of the reports (like Balance Sheet) have dynamic nested structure, i.e. the depth of nesting is not static. How can I convert the JSON to Java Objects so that I can work on them. Collectively some rows make sections and a section can contain either rows or sub-sections (This nesting can go deeper). The way to differentiate is the presence of type data or section in the rows value.

I was thinking on lines of writing a recursive function, which goes through the rows until it finds a row with type=data. But I am looking for something better. Link to QuickBooks Documentation.

This is the sample JSON.

{
  "Header": {
    "ReportName": "BalanceSheet", 
    "Option": [
      {
        "Name": "AccountingStandard", 
        "Value": "GAAP"
      }, 
      {
        "Name": "NoReportData", 
        "Value": "false"
      }
    ], 
    "DateMacro": "this calendar year-to-date", 
    "ReportBasis": "Accrual", 
    "StartPeriod": "2016-01-01", 
    "Currency": "USD", 
    "EndPeriod": "2016-10-31", 
    "Time": "2016-10-31T09:42:21-07:00", 
    "SummarizeColumnsBy": "Total"
  }, 
  "Rows": {
    "Row": [
      {
        "Header": {
          "ColData": [
            {
              "value": "ASSETS"
            }, 
            {
              "value": ""
            }
          ]
        }, 
        "Rows": {
          "Row": [
            {
              "Header": {
                "ColData": [
                  {
                    "value": "Current Assets"
                  }, 
                  {
                    "value": ""
                  }
                ]
              }, 
              "Rows": {
                "Row": [
                  {
                    "Header": {
                      "ColData": [
                        {
                          "value": "Bank Accounts"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "ColData": [
                            {
                              "id": "35", 
                              "value": "Checking"
                            }, 
                            {
                              "value": "1350.55"
                            }
                          ], 
                          "type": "Data"
                        }, 
                        {
                          "ColData": [
                            {
                              "id": "36", 
                              "value": "Savings"
                            }, 
                            {
                              "value": "800.00"
                            }
                          ], 
                          "type": "Data"
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "group": "BankAccounts", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Bank Accounts"
                        }, 
                        {
                          "value": "2150.55"
                        }
                      ]
                    }
                  }, 
                  {
                    "Header": {
                      "ColData": [
                        {
                          "value": "Accounts Receivable"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "ColData": [
                            {
                              "id": "84", 
                              "value": "Accounts Receivable (A/R)"
                            }, 
                            {
                              "value": "6383.12"
                            }
                          ], 
                          "type": "Data"
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "group": "AR", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Accounts Receivable"
                        }, 
                        {
                          "value": "6383.12"
                        }
                      ]
                    }
                  }, 
                  {
                    "Header": {
                      "ColData": [
                        {
                          "value": "Other current assets"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "ColData": [
                            {
                              "id": "81", 
                              "value": "Inventory Asset"
                            }, 
                            {
                              "value": "596.25"
                            }
                          ], 
                          "type": "Data"
                        }, 
                        {
                          "ColData": [
                            {
                              "id": "4", 
                              "value": "Undeposited Funds"
                            }, 
                            {
                              "value": "2117.52"
                            }
                          ], 
                          "type": "Data"
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "group": "OtherCurrentAssets", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Other current assets"
                        }, 
                        {
                          "value": "2713.77"
                        }
                      ]
                    }
                  }
                ]
              }, 
              "type": "Section", 
              "group": "CurrentAssets", 
              "Summary": {
                "ColData": [
                  {
                    "value": "Total Current Assets"
                  }, 
                  {
                    "value": "11247.44"
                  }
                ]
              }
            }, 
            {
              "Header": {
                "ColData": [
                  {
                    "value": "Fixed Assets"
                  }, 
                  {
                    "value": ""
                  }
                ]
              }, 
              "Rows": {
                "Row": [
                  {
                    "Header": {
                      "ColData": [
                        {
                          "id": "37", 
                          "value": "Truck"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "ColData": [
                            {
                              "id": "38", 
                              "value": "Original Cost"
                            }, 
                            {
                              "value": "13495.00"
                            }
                          ], 
                          "type": "Data"
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Truck"
                        }, 
                        {
                          "value": "13495.00"
                        }
                      ]
                    }
                  }
                ]
              }, 
              "type": "Section", 
              "group": "FixedAssets", 
              "Summary": {
                "ColData": [
                  {
                    "value": "Total Fixed Assets"
                  }, 
                  {
                    "value": "13495.00"
                  }
                ]
              }
            }
          ]
        }, 
        "type": "Section", 
        "group": "TotalAssets", 
        "Summary": {
          "ColData": [
            {
              "value": "TOTAL ASSETS"
            }, 
            {
              "value": "24742.44"
            }
          ]
        }
      }, 
      {
        "Header": {
          "ColData": [
            {
              "value": "LIABILITIES AND EQUITY"
            }, 
            {
              "value": ""
            }
          ]
        }, 
        "Rows": {
          "Row": [
            {
              "Header": {
                "ColData": [
                  {
                    "value": "Liabilities"
                  }, 
                  {
                    "value": ""
                  }
                ]
              }, 
              "Rows": {
                "Row": [
                  {
                    "Header": {
                      "ColData": [
                        {
                          "value": "Current Liabilities"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "Header": {
                            "ColData": [
                              {
                                "value": "Accounts Payable"
                              }, 
                              {
                                "value": ""
                              }
                            ]
                          }, 
                          "Rows": {
                            "Row": [
                              {
                                "ColData": [
                                  {
                                    "id": "33", 
                                    "value": "Accounts Payable (A/P)"
                                  }, 
                                  {
                                    "value": "1984.17"
                                  }
                                ], 
                                "type": "Data"
                              }
                            ]
                          }, 
                          "type": "Section", 
                          "group": "AP", 
                          "Summary": {
                            "ColData": [
                              {
                                "value": "Total Accounts Payable"
                              }, 
                              {
                                "value": "1984.17"
                              }
                            ]
                          }
                        }, 
                        {
                          "Header": {
                            "ColData": [
                              {
                                "value": "Credit Cards"
                              }, 
                              {
                                "value": ""
                              }
                            ]
                          }, 
                          "Rows": {
                            "Row": [
                              {
                                "ColData": [
                                  {
                                    "id": "41", 
                                    "value": "Mastercard"
                                  }, 
                                  {
                                    "value": "157.72"
                                  }
                                ], 
                                "type": "Data"
                              }
                            ]
                          }, 
                          "type": "Section", 
                          "group": "CreditCards", 
                          "Summary": {
                            "ColData": [
                              {
                                "value": "Total Credit Cards"
                              }, 
                              {
                                "value": "157.72"
                              }
                            ]
                          }
                        }, 
                        {
                          "Header": {
                            "ColData": [
                              {
                                "value": "Other Current Liabilities"
                              }, 
                              {
                                "value": ""
                              }
                            ]
                          }, 
                          "Rows": {
                            "Row": [
                              {
                                "ColData": [
                                  {
                                    "id": "89", 
                                    "value": "Arizona Dept. of Revenue Payable"
                                  }, 
                                  {
                                    "value": "4.55"
                                  }
                                ], 
                                "type": "Data"
                              }, 
                              {
                                "ColData": [
                                  {
                                    "id": "90", 
                                    "value": "Board of Equalization Payable"
                                  }, 
                                  {
                                    "value": "401.98"
                                  }
                                ], 
                                "type": "Data"
                              }, 
                              {
                                "ColData": [
                                  {
                                    "id": "43", 
                                    "value": "Loan Payable"
                                  }, 
                                  {
                                    "value": "4000.00"
                                  }
                                ], 
                                "type": "Data"
                              }
                            ]
                          }, 
                          "type": "Section", 
                          "group": "OtherCurrentLiabilities", 
                          "Summary": {
                            "ColData": [
                              {
                                "value": "Total Other Current Liabilities"
                              }, 
                              {
                                "value": "4406.53"
                              }
                            ]
                          }
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "group": "CurrentLiabilities", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Current Liabilities"
                        }, 
                        {
                          "value": "6548.42"
                        }
                      ]
                    }
                  }, 
                  {
                    "Header": {
                      "ColData": [
                        {
                          "value": "Long-Term Liabilities"
                        }, 
                        {
                          "value": ""
                        }
                      ]
                    }, 
                    "Rows": {
                      "Row": [
                        {
                          "ColData": [
                            {
                              "id": "44", 
                              "value": "Notes Payable"
                            }, 
                            {
                              "value": "25000.00"
                            }
                          ], 
                          "type": "Data"
                        }
                      ]
                    }, 
                    "type": "Section", 
                    "group": "LongTermLiabilities", 
                    "Summary": {
                      "ColData": [
                        {
                          "value": "Total Long-Term Liabilities"
                        }, 
                        {
                          "value": "25000.00"
                        }
                      ]
                    }
                  }
                ]
              }, 
              "type": "Section", 
              "group": "Liabilities", 
              "Summary": {
                "ColData": [
                  {
                    "value": "Total Liabilities"
                  }, 
                  {
                    "value": "31548.42"
                  }
                ]
              }
            }, 
            {
              "Header": {
                "ColData": [
                  {
                    "value": "Equity"
                  }, 
                  {
                    "value": ""
                  }
                ]
              }, 
              "Rows": {
                "Row": [
                  {
                    "ColData": [
                      {
                        "id": "34", 
                        "value": "Opening Balance Equity"
                      }, 
                      {
                        "value": "-9337.50"
                      }
                    ], 
                    "type": "Data"
                  }, 
                  {
                    "ColData": [
                      {
                        "id": "2", 
                        "value": "Retained Earnings"
                      }, 
                      {
                        "value": "91.25"
                      }
                    ], 
                    "type": "Data"
                  }, 
                  {
                    "ColData": [
                      {
                        "value": "Net Income"
                      }, 
                      {
                        "value": "2440.27"
                      }
                    ], 
                    "type": "Data", 
                    "group": "NetIncome"
                  }
                ]
              }, 
              "type": "Section", 
              "group": "Equity", 
              "Summary": {
                "ColData": [
                  {
                    "value": "Total Equity"
                  }, 
                  {
                    "value": "-6805.98"
                  }
                ]
              }
            }
          ]
        }, 
        "type": "Section", 
        "group": "TotalLiabilitiesAndEquity", 
        "Summary": {
          "ColData": [
            {
              "value": "TOTAL LIABILITIES AND EQUITY"
            }, 
            {
              "value": "24742.44"
            }
          ]
        }
      }
    ]
  }, 
  "Columns": {
    "Column": [
      {
        "ColType": "Account", 
        "ColTitle": "", 
        "MetaData": [
          {
            "Name": "ColKey", 
            "Value": "account"
          }
        ]
      }, 
      {
        "ColType": "Money", 
        "ColTitle": "Total", 
        "MetaData": [
          {
            "Name": "ColKey", 
            "Value": "total"
          }
        ]
      }
    ]
  }
}
2
  • you can use Gson or Jackson and convert the data of type Map<String,Object> Commented Oct 3, 2019 at 10:51
  • 2
    Probably a better idea to work with JsonNode instead of maps. Commented Oct 3, 2019 at 11:08

3 Answers 3

1

JSON Object can ALWAYS be converted to Map. JSON List can ALWAYS be converted to List. Object in those structures can be among other things Map<String, Object> or List<Object>. So you get your multi-nested structure with no depth limitation. To convert JSON to Java class and Java class to JSON is called deserialization and serialization respectively. Today there are 2 major known libraries that do that (and much more) for you. One is Jackson-JSON (otherwise known as "Fast XML" - go figure...) and the other is GSON - a Google library based on Jackson-JSON but also supports passing binary objects. I personally prefer Jackson-JSON, but that's the matter of personal preference. For GSON library look here. For Jackson look here. For Maven artifacts for Jackson look here. If you choose to work with Jackson, then the main class that you need is ObjectMapper. Start from looking into methods readValue() and writeValue(). Look for endless examples on the web on how to work with it. This should give you a good start

Sign up to request clarification or add additional context in comments.

1 Comment

This combined with @kayaman's comment did the trick for me.
0

Use reflection apis in java to create your custom type:

Type myType = new TypeToken<ArrayList<HashMap<String, Object>>() {}.getType();

Then use Gson api to convert the JSON into the Java object:

List<Map<String, Object>> outputList = new Gson().fromJson(inputJSONObject, myType);

And then you can iterate over your list and create some consumers to get the sub-objects out of it: UnaryOperator<Map<String, Object>> subMap = s -> { Map<String, Object> map = new HashMap<>(); map.put("Header", s.remove("Header")); ... ... return map; };

Comments

0

This is a super nested JSON object. This makes it complicated to do in Java and hard to troubleshoot. Nevertheless it can be done.

You could use BSON to load your code and then parse out the values. Start by importing your libraries.

 //import java.util.ArrayList;
 //import org.bson.Document;

Parse your JSON into a BSON Document

 Document root = Document.parse("{ \"Header\" : { \"ReportName\" : \"BalanceSheet\", \"Option\" : [{ \"Name\" : \"AccountingStandard\", \"Value\" : \"GAAP\" }, { \"Name\" : \"NoReportData\", \"Value\" : \"false\" }], \"DateMacro\" : \"this calendar year-to-date\", \"ReportBasis\" : \"Accrual\", \"StartPeriod\" : \"2016-01-01\", \"Currency\" : \"USD\", \"EndPeriod\" : \"2016-10-31\", \"Time\" : \"2016-10-31T09:42:21-07:00\", \"SummarizeColumnsBy\" : \"Total\" }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"ASSETS\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"Current Assets\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"Bank Accounts\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"35\", \"value\" : \"Checking\" }, { \"value\" : \"1350.55\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"id\" : \"36\", \"value\" : \"Savings\" }, { \"value\" : \"800.00\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"BankAccounts\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Bank Accounts\" }, { \"value\" : \"2150.55\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Accounts Receivable\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"84\", \"value\" : \"Accounts Receivable (A/R)\" }, { \"value\" : \"6383.12\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"AR\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Accounts Receivable\" }, { \"value\" : \"6383.12\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Other current assets\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"81\", \"value\" : \"Inventory Asset\" }, { \"value\" : \"596.25\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"id\" : \"4\", \"value\" : \"Undeposited Funds\" }, { \"value\" : \"2117.52\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"OtherCurrentAssets\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Other current assets\" }, { \"value\" : \"2713.77\" }] } }] }, \"type\" : \"Section\", \"group\" : \"CurrentAssets\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Current Assets\" }, { \"value\" : \"11247.44\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Fixed Assets\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"id\" : \"37\", \"value\" : \"Truck\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"38\", \"value\" : \"Original Cost\" }, { \"value\" : \"13495.00\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Truck\" }, { \"value\" : \"13495.00\" }] } }] }, \"type\" : \"Section\", \"group\" : \"FixedAssets\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Fixed Assets\" }, { \"value\" : \"13495.00\" }] } }] }, \"type\" : \"Section\", \"group\" : \"TotalAssets\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"TOTAL ASSETS\" }, { \"value\" : \"24742.44\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"LIABILITIES AND EQUITY\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"Liabilities\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"Current Liabilities\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"Header\" : { \"ColData\" : [{ \"value\" : \"Accounts Payable\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"33\", \"value\" : \"Accounts Payable (A/P)\" }, { \"value\" : \"1984.17\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"AP\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Accounts Payable\" }, { \"value\" : \"1984.17\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Credit Cards\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"41\", \"value\" : \"Mastercard\" }, { \"value\" : \"157.72\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"CreditCards\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Credit Cards\" }, { \"value\" : \"157.72\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Other Current Liabilities\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"89\", \"value\" : \"Arizona Dept. of Revenue Payable\" }, { \"value\" : \"4.55\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"id\" : \"90\", \"value\" : \"Board of Equalization Payable\" }, { \"value\" : \"401.98\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"id\" : \"43\", \"value\" : \"Loan Payable\" }, { \"value\" : \"4000.00\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"OtherCurrentLiabilities\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Other Current Liabilities\" }, { \"value\" : \"4406.53\" }] } }] }, \"type\" : \"Section\", \"group\" : \"CurrentLiabilities\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Current Liabilities\" }, { \"value\" : \"6548.42\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Long-Term Liabilities\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"44\", \"value\" : \"Notes Payable\" }, { \"value\" : \"25000.00\" }], \"type\" : \"Data\" }] }, \"type\" : \"Section\", \"group\" : \"LongTermLiabilities\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Long-Term Liabilities\" }, { \"value\" : \"25000.00\" }] } }] }, \"type\" : \"Section\", \"group\" : \"Liabilities\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Liabilities\" }, { \"value\" : \"31548.42\" }] } }, { \"Header\" : { \"ColData\" : [{ \"value\" : \"Equity\" }, { \"value\" : \"\" }] }, \"Rows\" : { \"Row\" : [{ \"ColData\" : [{ \"id\" : \"34\", \"value\" : \"Opening Balance Equity\" }, { \"value\" : \"-9337.50\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"id\" : \"2\", \"value\" : \"Retained Earnings\" }, { \"value\" : \"91.25\" }], \"type\" : \"Data\" }, { \"ColData\" : [{ \"value\" : \"Net Income\" }, { \"value\" : \"2440.27\" }], \"type\" : \"Data\", \"group\" : \"NetIncome\" }] }, \"type\" : \"Section\", \"group\" : \"Equity\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"Total Equity\" }, { \"value\" : \"-6805.98\" }] } }] }, \"type\" : \"Section\", \"group\" : \"TotalLiabilitiesAndEquity\", \"Summary\" : { \"ColData\" : [{ \"value\" : \"TOTAL LIABILITIES AND EQUITY\" }, { \"value\" : \"24742.44\" }] } }] }, \"Columns\" : { \"Column\" : [{ \"ColType\" : \"Account\", \"ColTitle\" : \"\", \"MetaData\" : [{ \"Name\" : \"ColKey\", \"Value\" : \"account\" }] }, { \"ColType\" : \"Money\", \"ColTitle\" : \"Total\", \"MetaData\" : [{ \"Name\" : \"ColKey\", \"Value\" : \"total\" }] }] } }");

You can then call out the values using the following syntax. For the arrays you can iterate through the number of values. In order for this to work you need to know what the values are being returned as (I.E. Int, String, or Document) . BSON returns the values as an "Object" so you will have to cast the value. For example: (String) bson.get("field"). This JSON is super large. Here are some examples of how to parse in a single line.

System.out.println(((String)((Document)root.get("Header")).get("ReportName")));
 System.out.println(((String)((Document)((ArrayList)((Document)root.get("Header")).get("Option")).get(0)).get("Name")));
 System.out.println(((String)((Document)((ArrayList)((Document)root.get("Header")).get("Option")).get(0)).get("Value")));

 System.out.println(((String)((Document)root.get("Header")).get("DateMacro")));
 System.out.println(((String)((Document)root.get("Header")).get("ReportBasis")));
 System.out.println(((String)((Document)root.get("Header")).get("StartPeriod")));
 System.out.println(((String)((Document)root.get("Header")).get("Currency")));
 System.out.println(((String)((Document)root.get("Header")).get("EndPeriod")));
 System.out.println(((String)((Document)root.get("Header")).get("Time")));
 System.out.println(((String)((Document)root.get("Header")).get("SummarizeColumnsBy")));

 System.out.println(((String)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)root.get("Rows")).get("Row")).get(0)).get("Header")).get("ColData")).get(0)).get("value")));

 System.out.println(((String)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)root.get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Header")).get("ColData")).get(0)).get("value")));

 System.out.println(((String)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)root.get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Header")).get("ColData")).get(0)).get("value")));


 System.out.println(((String)((Document)((ArrayList)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)root.get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("ColData")).get(0)).get("id")));
 System.out.println(((String)((Document)((ArrayList)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)((Document)((ArrayList)((Document)root.get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("Rows")).get("Row")).get(0)).get("ColData")).get(0)).get("value")));


 System.out.println(((String)((Document)((ArrayList)((Document)((ArrayList)((Document)root.get("Columns")).get("Column")).get(1)).get("MetaData")).get(0)).get("Name")));
 System.out.println(((String)((Document)((ArrayList)((Document)((ArrayList)((Document)root.get("Columns")).get("Column")).get(1)).get("MetaData")).get(0)).get("Value")));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.