List of usage examples for org.json.extension JSONConstructor key
JSONConstructor key(String key) throws JSONException;
From source file:de.cosmocode.palava.legacy.UpdateResult.java
@Override public void encodeJSON(JSONConstructor json) throws JSONException { json.object();/*from w w w. j a v a 2 s .c o m*/ if (errors == null && result == null && exception == null) { json.key("status").value("success"); } else { json.key("status").value(isError() ? "error" : "success"); if (errors != null) json.key("errors").value(errors); if (exception != null) json.key("exception").value(exception.toString()); if (result != null) { json.key("result"); if (result instanceof JSONEncoder) { final boolean objects = result instanceof NoObjectContext; if (objects) json.object(); ((JSONEncoder) result).encodeJSON(json); if (objects) json.endObject(); } else json.value(result); } } json.endObject(); }