import java.util.Map;
import com.alibaba.fastjson.JSONObject;
public class forJson {
public static void main(String[] args) {
// TODO Auto-generated method stub
JSONObject jsonObject = new JSONObject();
jsonObject.put("key", "value");
jsonObject.put("key1", "value1");
jsonObject.put("key2", "value2");
//
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
for (String key : jsonObject.keySet()) {
//System.out.println(key.getKey() + ":" + key.getValue());
System.out.println(key +":"+ jsonObject.getString(key));
}
}
}