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,Object>> parserJsonStringToMapList(String s) {
        JSONArray ja = new JSONArray(s);
        JSONObject jo = ja.getJSONObject(0);
        Iterator it = jo.keys();
        List<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
        while (it.hasNext()) {
            Map<String, Object> map = new HashMap<String, Object>();
            String key = (String) it.next();
            Object value = jo.getString(key);
            map.put(key, value);
            l.add(map);
        }
        return l;
    }
}
