import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MapTest {
public static void main(String[] args) {
String str="{'name':'小明','sex':'男','age':20}";
HashMap map = JSON.parseObject(str, HashMap.class);
for (Object key : map.keySet()) {
System.out.println(key+" "+map.get(key));
}
}
}
打印结果:
