x.json2.decoder2 #
fn decode #
fn decode[T](val string) !T
decode decodes a JSON string into a specified type.
fn string_buffer_to_generic_number #
fn string_buffer_to_generic_number[T](result &T, data []u8)
string_buffer_to_generic_number converts a buffer of bytes (data) into a generic type T and stores the result in the provided result pointer. The function supports conversion to the following types:- Signed integers: i8, i16, i32, i64
- Unsigned integers: u8, u16, u32, u64
- Floating-point numbers: f32, f64
For signed integers, the function handles negative numbers by checking for a '-' character. For floating-point numbers, the function handles decimal points and adjusts the result accordingly.
If the type T is not supported, the function will panic with an appropriate error message.
Parameters:- data []u8: The buffer of bytes to be converted.
- result &T: A pointer to the variable where the converted result will be stored.
Note: This aims works with not new memory allocated data, to more efficient use vbytes
before
enum ValueKind #
enum ValueKind {
unknown
array
object
string_
number
boolean
null
}
ValueKind represents the kind of a JSON value.