@osprey/json API Reference

ui

Name Kind Description
Doc Module Total readers and member builders over Osprey's built-in Json, for the framework's own trusted state. Validate hostile input with the built-in Result readers instead.

ui::Doc

Total readers and member builders over Osprey's built-in Json, for the framework's own trusted state. Validate hostile input with the built-in Result readers instead.

Name Kind Description
parse Function source as JSON, or JsonNull when it is not JSON.
field Function The member key of an object, or JsonNull when it is absent or doc is not an object.
has Function True when the object doc has a member named key, whatever its value.
text Function The string member key, or an empty string when it is absent or not a string.
number Function The integer member key, or 0 when it is absent or not an integer.
decimal Function The float member key; an integer member reads as its float, and an absent or non-numeric one as 0.
flag Function The boolean member key, or false when it is absent or not a boolean.
kind Function What value is: "null", "bool", "number" (an integer or a float), "text", "list" or "object".
real Function A number as a float, an integer widened; anything else reads as 0.
items Function The elements of an array, or none when doc is not an array.
members Function The members of an object, or none when doc is not an object.
at Function The element at index of an array, or JsonNull when there is none.
string Function A string value's text, or "" when value is not a string.
keys Function The member names of an object, in document order; none when doc is not an object.
texts Function The array member key as strings; an element that is not a string reads as an empty string.
str Function A string member for building an object.
num Function An integer member for building an object.
dec Function A float member for building an object.
bit Function A boolean member for building an object.
strings Function A JSON array of values.
write Function doc as compact JSON text.