JSON parsing and stringification conforming to RFC 8259. https://datatracker.ietf.org/doc/html/rfc8259
The low-level Scanner
API produces Token
s from an input slice or successive slices of inputs, The Reader
API connects a std.io.Reader
to a Scanner
.
The high-level parseFromSlice
and parseFromTokenSource
deserialize a JSON document into a Zig type. Parse into a dynamically-typed Value
to load any JSON value for runtime inspection.
The low-level writeStream
emits syntax-conformant JSON tokens to a std.io.Writer
. The high-level stringify
serializes a Zig or Value
type into JSON.
Functions
fn encodeJsonString(string: []const u8, options: StringifyOptions, writer: anytype) !void
No documentation provided.
fn encodeJsonStringChars(chars: []const u8, options: StringifyOptions, writer: anytype) !void
No documentation provided.
fn innerParse(comptime T: type, allocator: Allocator, source: anytype, options: ParseOptions) ParseError(@TypeOf(load))!T
No documentation provided.
fn innerParseFromValue(comptime T: type, allocator: Allocator, source: Value, options: ParseOptions) ParseFromValueError!T
No documentation provided.
fn parseFromSlice(comptime T: type, allocator: Allocator, s: []const u8, options: ParseOptions) ParseError(Scanner)!Parsed(T)
No documentation provided.
fn parseFromSliceLeaky(comptime T: type, allocator: Allocator, s: []const u8, options: ParseOptions) ParseError(Scanner)!T
No documentation provided.
fn parseFromTokenSource(comptime T: type, allocator: Allocator, scanner_or_reader: anytype, options: ParseOptions) ParseError(@TypeOf(load))!Parsed(T)
No documentation provided.
fn parseFromTokenSourceLeaky(comptime T: type, allocator: Allocator, scanner_or_reader: anytype, options: ParseOptions) ParseError(@TypeOf(load))!T
No documentation provided.
fn parseFromValue(comptime T: type, allocator: Allocator, source: Value, options: ParseOptions) ParseFromValueError!Parsed(T)
No documentation provided.
fn parseFromValueLeaky(comptime T: type, allocator: Allocator, source: Value, options: ParseOptions) ParseFromValueError!T
No documentation provided.
fn reader(allocator: Allocator, io_reader: anytype) Reader(default_buffer_size, @TypeOf(io_reader))
No documentation provided.
fn stringify(value: anytype, options: StringifyOptions, out_stream: anytype) @TypeOf(out_stream).Error!void
No documentation provided.
fn stringifyAlloc(allocator: Allocator, value: anytype, options: StringifyOptions) error{OutOfMemory}![]const u8
No documentation provided.
fn stringifyArbitraryDepth(allocator: Allocator, value: anytype, options: StringifyOptions, out_stream: anytype) T.Error!void
No documentation provided.
fn stringifyMaxDepth(value: anytype, options: StringifyOptions, out_stream: anytype, comptime max_depth: ?usize) @TypeOf(out_stream).Error!void
No documentation provided.
fn writeStream(out_stream: anytype, options: StringifyOptions) WriteStream(@TypeOf(out_stream), .{ .checked_to_fixed_depth = 256 })
No documentation provided.
fn writeStreamArbitraryDepth(allocator: Allocator, out_stream: anytype, options: StringifyOptions) WriteStream(@TypeOf(out_stream), .checked_to_arbitrary_depth)
No documentation provided.
fn writeStreamMaxDepth(out_stream: anytype, options: StringifyOptions, comptime max_depth: ?usize) WriteStream(@TypeOf(out_stream), if (max_depth) |d| .{ .checked_to_fixed_depth = d } else .assumed_correct)
No documentation provided.
Values
Array | undefined | |
ObjectMap | undefined | |
ParseFromValueError | type | |
Parser | undefined | |
StreamingParser | undefined | |
TokenStream | undefined | |
ValueTree | undefined | |
default_buffer_size | comptime_int | |
default_max_value_len | type | |
parse | undefined | |
parseFree | undefined |