io.datawire.quark.runtime.JSONObject Maven / Gradle / Ivy
package io.datawire.quark.runtime;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.jr.ob.JSON;
public class JSONObject {
private Object value;
public JSONObject() {
this.value = null;
}
protected JSONObject(Object value) {
this.value = value;
}
public String toString() {
try {
return JSON.std
.with(JSON.Feature.WRITE_NULL_PROPERTIES)
.asString(this.value);
} catch (Exception ex) {
return null; // XXX json error handling
}
}
public static JSONObject parse(String json) {
try {
return wrap(JSON.std.anyFrom(json));
} catch (Exception ex) {
return undefined();
}
}
private static JSONObject wrap(Object o) {
return new JSONObject(o);
}
public static JSONObject undefined() {
return _undefined;
}
public JSONObject setObject() {
this.value = new LinkedHashMap();
return this;
}
public JSONObject setList() {
this.value = new ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy