Function parseFromValue [src]

Alias for std.json.static.parseFromValue

Like parseFromSlice, but the input is an already-parsed std.json.Value object. Only options.ignore_unknown_fields is used from options.

Prototype

pub fn parseFromValue( comptime T: type, allocator: Allocator, source: Value, options: ParseOptions, ) ParseFromValueError!Parsed(T)

Parameters

T: typeallocator: Allocatorsource: Valueoptions: ParseOptions

Possible Errors

DuplicateField
InvalidCharacter ParseIntError

The input was empty or contained an invalid character

InvalidEnumTag
InvalidNumber
LengthMismatch
MissingField
OutOfMemory Error
Overflow ParseIntError

The result cannot fit in the type specified

UnexpectedToken
UnknownField

Source

pub fn parseFromValue( comptime T: type, allocator: Allocator, source: Value, options: ParseOptions, ) ParseFromValueError!Parsed(T) { var parsed = Parsed(T){ .arena = try allocator.create(ArenaAllocator), .value = undefined, }; errdefer allocator.destroy(parsed.arena); parsed.arena.* = ArenaAllocator.init(allocator); errdefer parsed.arena.deinit(); parsed.value = try parseFromValueLeaky(T, parsed.arena.allocator(), source, options); return parsed; }