JSONObject转String后null值不输出

    技术2025-04-18  8

    直接上代码:

    JSONObject jsonObject = new JSONObject(); jsonObject.add("name",null); String str = jsonObject.toString();//{} str = JSONObject.toJSONString(jsonObject, SerializerFeature.WriteMapNullValue);//{"name",null}
    Processed: 0.010, SQL: 9