This commit is contained in:
hrxiang
2021-07-09 17:23:20 +08:00
parent 86dca45d0b
commit cdb68da336
2 changed files with 8 additions and 1 deletions

View File

@@ -4,6 +4,13 @@ import org.json.JSONObject;
public class JsonUtil {
public static String toString(Object o) {
if (o instanceof String) {
StringBuffer buffer = new StringBuffer();
buffer.append("\"");
buffer.append(o);
buffer.append("\"");
return buffer.toString();
}
Object obj = JSONObject.wrap(o);
if (null != obj) {
return obj.toString();