API Reference › Value
namespace

Value

A generic, self-describing value tree — the node type reflection serializes into and JSON round-trips through. A node is one of null, int, fixed, bool, str, list, or object (see Value.kind). Build one with the constructors (Value.int, Value.object, …) and the builders Value.add/Value.put; read it with Value.get/Value.at/Value.count and the as_* accessors. Related: Json, Reflect.

Value.null() -> valueAn empty null node.Value.int(n: int) -> valueWrap an int in a value node.Value.fixed(f: fixed) -> valueWrap a fixed in a value node.Value.bool(b: bool) -> valueWrap a bool in a value node.Value.str(s: string) -> valueWrap a string in a value node.Value.list() -> valueAn empty list node.Value.object() -> valueAn empty object node.Value.add(list, item) -> valueAppend an item to a list; returns the list.Value.put(obj, key: string, item) -> valueSet a key on an object; returns the object.Value.get(obj, key: string) -> valueRead a member of an object by key.Value.has(obj, key: string) -> boolWhether an object has a member.Value.at(list, index: int) -> valueRead a list item by index.Value.key_at(obj, index: int) -> stringThe key of an object member by position.Value.count(value) -> intNumber of items/members in a list or object.Value.kind(value) -> intThe node's kind tag.Value.as_int(value) -> intRead a scalar node as an int.Value.as_str(value) -> stringRead a str node's text.
← All symbols