wrap
Wraps a String as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a string.
Wraps a char as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a char.
Wraps an int as a JsonValue.
Return
The JsonValue object.
Parameters
The value as an int.
Wraps a long as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a long.
Wraps a boolean as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a boolean.
Wraps a double as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a double.
Wraps a JsonSerializable object as a JsonValue.
Return
The JsonValue object.
Parameters
The value as a JsonSerializable object.
Wraps any valid object into a JsonValue. If the object is unable to be wrapped, the default value will be returned. See wrap for rules on object wrapping.
Return
The object wrapped in a JsonValue or the default value if the object is unable to be wrapped.
Parameters
The object to wrap.
The default value if the object is unable to be wrapped.
Wraps any valid object into a JsonValue.
Objects will be wrapped with the following rules:
- JSONObject.NULL or null will result in NULL.
- Collections, arrays, JSONArray values will be wrapped into a JsonList
- Maps with String keys will be wrapped into a JsonMap.
- Strings, primitive wrapper objects, JsonMaps, and JsonLists will be wrapped directly into a JsonValue
- Objects that implement JsonSerializable will return toJsonValue or NULL.
- JsonValues will be unmodified.
Return
The object wrapped in a JsonValue.
Parameters
The object to wrap.
Throws
If the object is not a supported type or contains an unsupported type.