/** * Convert a JSONObject into a well-formed, element-normal XML string. * @param o A JSONObject. * @return A string. * @throws JSONException */ public static String toString(Object o) throws JSONException { return toString(o, null); }
/** * Convert a JSONObject into a well-formed, element-normal XML string. * @param o A JSONObject. * @return A string. * @throws JSONException */ public static String toString(Object o) throws JSONException { return toString(o, null); }
j = XML.toJSONObject(s); System.out.println(j.toString(2)); System.out.println(XML.toString(j)); System.out.println(""); j = new JSONObject(s); System.out.println(j.toString(4)); System.out.println(XML.toString(j)); System.out.println(XML.toString(j)); System.out.println(""); j.put("keys", JSONObject.getNames(j)); System.out.println(j.toString(4)); System.out.println(XML.toString(j)); j = XML.toJSONObject(s); System.out.println(j.toString(2)); System.out.println(XML.toString(j)); System.out.println(""); System.out.println(XML.toString(j)); System.out.println(""); ja = JSONML.toJSONArray(s); System.out.println(XML.toString(j)); System.out.println(""); System.out.println(XML.toString(j));
j = XML.toJSONObject(s); System.out.println(j.toString(2)); System.out.println(XML.toString(j)); System.out.println(""); j = new JSONObject(s); System.out.println(j.toString(4)); System.out.println(XML.toString(j)); System.out.println(XML.toString(j)); System.out.println(""); j.put("keys", JSONObject.getNames(j)); System.out.println(j.toString(4)); System.out.println(XML.toString(j)); j = XML.toJSONObject(s); System.out.println(j.toString(2)); System.out.println(XML.toString(j)); System.out.println(""); System.out.println(XML.toString(j)); System.out.println(""); ja = JSONML.toJSONArray(s); System.out.println(XML.toString(j)); System.out.println(""); System.out.println(XML.toString(j));