serialize
Boxed
object Boxed
Utility object to manage deserialized data from, for example, decoded JSON
data
data: any
Wrapped data.
init
static fun init(data: any) > Boxed !> CircularReference, NotSerializable
Creates a Boxed wrapper around serializable data.
data: Data to wrap Returns: A newBoxed
string
fun string() > str?
When wrapped data is a string
boolean
fun boolean() > bool?
When wrapped data is a boolean
integer
fun integer() > int?
When wrapped data is a int
float
fun float() > double?
When wrapped data is a double
map
fun map() > {str: Boxed}?
When wrapped data is an object, object property values are themselves wrapped in a Boxed
list
fun list() > [Boxed]?
When wrapped data is a list, list elements are themselves warpped in a Boxed
stringValue
fun stringValue() > str
Returns: wrapped data string value or empty string if not a string
booleanValue
fun booleanValue() > bool
Returns: wrapped data boolean value or false if not a boolean
integerValue
fun integerValue() > int
Returns: wrapped data number value or 0 if not an integer
floatValue
fun floatValue() > double
Returns: wrapped data number value or 0 if not a double
mapValue
fun mapValue() > {str: Boxed}
Returns: wrapped data map value or empty map if not a map
listValue
fun listValue() > [Boxed]
Returns: wrapped data list value or empty list if not a list
q
fun q(path: [any]) > Boxed
Query the json element at path, if nothing matches return Boxed{}
path: Path to query Returns: FoundBoxedorBoxed{}(which isnull)
CircularReference
object CircularReference
Error raised when serialization detects a circular reference.
NotSerializable
object NotSerializable
Error raised when a value cannot be serialized.
serializeValue
fun serializeValue(value: any) > any !> CircularReference, NotSerializable
Converts any serializable Buzz value into JSON-compatible data.
value: Value to serialize Returns: Serialized data
JsonParseError
object JsonParseError
Error raised when JSON parsing fails.
jsonEncode
fun jsonEncode(data: Boxed) > str !> CircularReference, NotSerializable
Encode to a JSON string Returns: the JSON string
jsonDecode
fun jsonDecode(json: str) > Boxed !> JsonParseError, WriteWhileReadingError
Decode string into a Json instance
str: json The JSON string Returns: Boxed
