trick9191 7 yıl önce
ebeveyn
işleme
1d58557617

+ 27 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MapListUtils.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.util;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.*;
/**
 * Created by Trick on 2017/6/7.
 */
public class MapListUtils {
    public static List<Map<String,String>> parserJsonStringToMapList(String s) {
        JSONArray ja = new JSONArray(s);
        JSONObject jo = ja.getJSONObject(0);
        Iterator it = jo.keys();
        List<Map<String, String>> l = new ArrayList<Map<String, String>>();
        while (it.hasNext()) {
            Map<String, String> map = new HashMap<String, String>();
            String key = (String) it.next();
            String value = jo.getString(key);
            map.put(key, value);
            l.add(map);
        }
        return l;
    }
}