When I try to put "null"
string value to a JSONObject
using the API JSONObject.element(key, value)
, this API converts this "null"
string value to null
.
API used: net.sf.json.JSONObject, JAR version: json-lib-2.3-jdk15
JSONObject jObj = new JSONObject();
jObj.element("msg", null);
For the given code snippet, the output is
{"msg":null}
However, it should be
{"msg":"null"}
Never mind, I have handled this at the UI side. The JSONObject API doesn't support the requirement.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.