- try {
- root = (JSONObject) parser.parse(input);
- JSONObject aggregations = (JSONObject) root.get("aggregations");
- AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations);
- AggregationResults aggs = new AggregationResults();
- ObjectMapper mapper = new ObjectMapper();
- aggs.setAggregations(results);
- System.out.println(mapper.setSerializationInclusion(Include.NON_NULL)
- .writerWithDefaultPrettyPrinter().writeValueAsString(aggs));
- } catch (Exception e) {
- e.printStackTrace();
+ try {
+ root = (JSONObject) parser.parse(input);
+ JSONObject aggregations = (JSONObject) root.get("aggregations");
+ AggregationResult[] results = AggregationParsingUtil.parseAggregationResults(aggregations);
+ AggregationResults aggs = new AggregationResults();
+ ObjectMapper mapper = new ObjectMapper();
+ aggs.setAggregations(results);
+ System.out.println(mapper.setSerializationInclusion(Include.NON_NULL).writerWithDefaultPrettyPrinter()
+ .writeValueAsString(aggs));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }