tiny.preserves.fromJsonString
Defined in json.
Parses json_text and returns the Preserves value it describes, allocated with alloc, for code that receives JSON text.
Source
Source: lib/preserves/src/json.zig:293
zig
/// Parses `json_text` and returns the Preserves value it describes, allocated with `alloc`, for/// code that receives JSON text. The value owns all its memory, and the caller frees it with/// `deinit`. The mapping is the one `fromJsonValue` applies to the parsed JSON. Malformed JSON/// returns `error.OutOfMemory`, the only error the call reports. If memory runs out inside a/// `__record__`, `$rest`, `$capture`, `$bind` or `"type"` object, the call leaks the parts already/// built.pub fn fromJsonString(alloc: Allocator, json_text: []const u8) !Value { const parsed = std.json.parseFromSlice(std.json.Value, alloc, json_text, .{}) catch return error.OutOfMemory; defer parsed.deinit(); return jsonToValue(alloc, parsed.value);}Source: lib/preserves/src/root.zig:305
zig
pub const fromJsonString = json.fromJsonString;Complete caller list
11 direct callers.
lib.preserves.src.json.checkEmbeddedJsonAllocationFailures[function] — private source atlib/preserves/src/json.zig:816in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_$capture_/_$bind_/_$rest_round-trip_through_JSON[function] — test source atlib/preserves/src/json.zig:832in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:___discard___round-trip[function] — test source atlib/preserves/src/json.zig:657in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:___embedded___payloads_are_owned_and_cloneable[function] — test source atlib/preserves/src/json.zig:794in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:___record___round-trip[function] — test source atlib/preserves/src/json.zig:705in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:_array_maps_to_sequence[function] — test source atlib/preserves/src/json.zig:689in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:_plain_object_becomes_dictionary[function] — test source atlib/preserves/src/json.zig:697in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:_primitives[function] — test source atlib/preserves/src/json.zig:635in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:_protocol_type_lookup[function] — test source atlib/preserves/src/json.zig:664in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_fromJsonString:_unknown_type_becomes_tagged_dict_record[function] — test source atlib/preserves/src/json.zig:677in nearest public ownertiny.preserves.jsonlib.preserves.src.json.test_toJsonString_+_fromJsonString:_sequence_round-trip[function] — test source atlib/preserves/src/json.zig:714in nearest public ownertiny.preserves.json
Audit
| Definitions | 1 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |