package core.encoding.json
Value_Type :: enum {
Null :: 0
Bool :: 1
Integer :: 2
Float :: 3
String :: 4
Array :: 5
Object :: 6
}
Decode_Error :: #distinct &_Decode_Error
Methods
Value :: #distinct &_Value
Methods
as_any :: macro (value: Value, $T: type_expr) -> T
as_any :: macro (value: Value, out: &$T) -> void
as_any :: (value: Value, type: type_expr, out: rawptr) -> void
decode :: (data: [] u8, allocator: Allocator, print_errors: bool) -> Json
Unsafely decodes a strings into a json object, returning an invalid Json value if it failed to parse.
This procedure is not very useful and should be considered deprecated.
decode_into :: (data: str, out: &$T) -> Error
Decodes a string into any Onyx type.
Internally uses decode_with_result
and as_any
.
decode_with_error :: (data: [] u8, allocator: Allocator) -> (Json, Decode_Error)
Decodes a string into a Json object, and returns the Json object and and a Decode_Error
that is non-null if an error occured.
This procedure should be considered deprecated in favor of decode_with_result
.
decode_with_result :: (data: [] u8, allocator: Allocator) -> Result(Json, Error)
Decodes a string into a possible Json object. If parsing fails, an error is returned instead.
encode :: (w: &Writer, v: i32) -> Encoding_Error
encode :: (w: &Writer, v: i64) -> Encoding_Error
encode :: (w: &Writer, v: f32) -> Encoding_Error
encode :: (w: &Writer, v: f64) -> Encoding_Error
encode :: (w: &Writer, v: [] u8) -> Encoding_Error
encode :: (w: &io.Writer, v: [] $T) -> Encoding_Error
encode :: (w: &io.Writer, v: [..] $T) -> Encoding_Error
encode :: (w: &io.Writer, v: Map(str, $T)) -> Encoding_Error
encode :: (w: &Writer, v: Value) -> Encoding_Error
encode :: (w: &Writer, data: any) -> Encoding_Error
free_value :: (v: Value, allocator: Allocator) -> void
Frees a single Value, non-recursively.
from_any :: macro (v: &$T, allocator) -> Value
from_any :: macro (v: $T, allocator) -> Value
from_any :: (type: type_expr, input: rawptr, allocator: Allocator) -> Value
set :: macro (v: Value, key: [] u8, value: Value, dont_copy_key: bool) -> void
set :: macro (v: Value, key: [] u8, value: [] u8, dont_copy_key: bool, dont_copy_value: bool) -> i32