/** * Make a prettyprinted JSON text of this JSONArray. Warning: This method * assumes that the data structure is acyclical. * * @param indentFactor * The number of spaces to add to each level of indentation. * @return a printable, displayable, transmittable representation of the * object, beginning with <code>[</code> <small>(left * bracket)</small> and ending with <code>]</code> <small>(right * bracket)</small>. * @throws JSONException */ public String toString(int indentFactor) throws JSONException { return toString(indentFactor, 0); }
/** * Make a prettyprinted JSON text of this JSONArray. Warning: This method * assumes that the data structure is acyclical. * * @param indentFactor * The number of spaces to add to each level of indentation. * @return a printable, displayable, transmittable representation of the * object, beginning with <code>[</code> <small>(left * bracket)</small> and ending with <code>]</code> <small>(right * bracket)</small>. * @throws JSONException */ public String toString(int indentFactor) throws JSONException { return toString(indentFactor, 0); }
/** * Create a content object from a JSON array. Use this to POST the content to a URL. * * @param someJson * the JSON array to use * @return the content to send */ public static Content content(JSONArray someJson) { Content c = null; try { c = new Content("application/json; charset=UTF-8", someJson.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */ } return c; }
results.setEquivalentConceptsFound(equivalentConceptsFound); if (equivalentConceptsFound) { results.setEquivalentConceptsJson(toPrettyJson(items.toString()));
s = "[0.1]"; a = new JSONArray(s); System.out.println(a.toString()); System.out.println(""); System.out.println(a.toString(4)); System.out.println(JSONML.toString(a)); System.out.println(); System.out.println(a.toString(4)); System.out.println(JSONML.toString(a)); System.out.println(); System.out.println(new JSONArray(jj.toString()).toString(4)); System.out.println(ja.toString()); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja)); System.out.println(""); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja)); System.out.println(""); System.out.println(""); ja = JSONML.toJSONArray(s); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja));
s = "[0.1]"; a = new JSONArray(s); System.out.println(a.toString()); System.out.println(""); System.out.println(a.toString(4)); System.out.println(JSONML.toString(a)); System.out.println(); System.out.println(a.toString(4)); System.out.println(JSONML.toString(a)); System.out.println(); System.out.println(new JSONArray(jj.toString()).toString(4)); System.out.println(ja.toString()); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja)); System.out.println(""); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja)); System.out.println(""); System.out.println(""); ja = JSONML.toJSONArray(s); System.out.println(ja.toString(4)); System.out.println(JSONML.toString(ja));