
spring3.0 怎么把json里面的null值替换成空字符串 15
展开全部
恐怕要自己修改 JSONWriter.class
private void string(Object obj)
{
add('"');
CharacterIterator it = new StringCharacterIterator(obj.toString());
for (char c = it.first(); c != 65535; c = it.next()) {
if (c == '"')
add("\\\"");
else if (c == '\\')
add("\\\\");
else if (c == '/')
add("\\/");
else if (c == '\b')
add("\\b");
else if (c == '\f')
add("\\f");
else if (c == '\n')
add("\\n");
else if (c == '\r')
add("\\r");
else if (c == '\t')
add("\\t");
else if (Character.isISOControl(c))
unicode(c);
else {
add(c);
}
}
add('"');
}
private void string(Object obj)
{
add('"');
CharacterIterator it = new StringCharacterIterator(obj.toString());
for (char c = it.first(); c != 65535; c = it.next()) {
if (c == '"')
add("\\\"");
else if (c == '\\')
add("\\\\");
else if (c == '/')
add("\\/");
else if (c == '\b')
add("\\b");
else if (c == '\f')
add("\\f");
else if (c == '\n')
add("\\n");
else if (c == '\r')
add("\\r");
else if (c == '\t')
add("\\t");
else if (Character.isISOControl(c))
unicode(c);
else {
add(c);
}
}
add('"');
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询