N
N
nikesport2014-11-14 11:18:34
Java
nikesport, 2014-11-14 11:18:34

How to serialize JSON?

How to serialize JSON?
JSONObject resultJson = new JSONObject();
resultJson.put("name","foo");
resultJson.put("num",new Integer(100));
resultJson.put("is_vip",new Boolean(true));
resultJson.put("nickname",null);
System.out.print(obj.toString());

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
brutal_lobster, 2014-11-14
@brutal_lobster

So what's the point of serializing json?) This is actually a string ready for use)
toString() is exactly what you need.
System.out.print(resultJson.toString());

O
one pavel, 2014-11-14
@onepavel

In google type "android json to string"
stackoverflow.com/questions/5933753/jsonobject-to-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question