Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.factual.driver;
 
 import java.util.List;
 import java.util.Map;
 
 import  org.json.JSONArray;
 import  org.json.JSONException;
 import  org.json.JSONObject;
public class JsonUtil {

  
Takes a JSONArray of records, where each record is a dictionary, and returns the translated List of Maps.
  public static List<Map<StringObject>> data(JSONArray arrthrows JSONException {
    List<Map<StringObject>> data = Lists.newArrayList();
    for(int i=0; i<arr.length(); i++) {
      data.add(row(arr.getJSONObject(i)));
    }
    return data;
  }
  private static Map<StringObjectrow(JSONObject jothrows JSONException {
    Map<StringObjectrow = Maps.newHashMap();
    Iterator<?> iter = jo.keys();
    while(iter.hasNext()) {
      String key = iter.next().toString();
      Object value = jo.get(key);
      row.put(keyvalue);
    }
    return row;
  }
New to GrepCode? Check out our FAQ X