Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 private static SataList getSubSataList(JSONArray jsonArray) {
   SataList list = new SataListImpl();
   for (int i = 0; i < jsonArray.size(); i++) {
     JSONObject object = jsonArray.getJSONObject(i);
     SataMap sataMap = new SataMapImpl();
     sataMap.putAll(json2SataMap(object));
     list.add(sataMap);
   }
   return list;
 }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public static SataMap sataMap2SataMap(SataMap subSataMap) {
    SataMap sataMap = new SataMapImpl();
    for (Iterator<Map.Entry<String, Object>> it = subSataMap.entrySet().iterator();
        it.hasNext(); ) {
      Entry<String, Object> entry = it.next();
      if (entry.getValue() instanceof SataList) {
        SataList sataList = (SataList) entry.getValue();
        for (int i = 0; i < sataList.size(); i++) {
          if (sataList.get(i) instanceof SataMap) {
            sataMap.putAll(sataMap2SataMap((SataMap) sataList.get(i)));
          }
        }
      } else {

        sataMap.put(entry.getKey().toString(), entry.getValue());
      }
    }
    return sataMap;
  }