Decodes a T from one piece of text: an integer, float, bool, string or enum. from_param(int, "42") is 42; from_param(Color, "red") the member red; a string is taken as it is.
number, error := from_param(int, "42");
assert(error.kind == .NONE && number == 42);
_, error = from_param(int, "forty-two");
assert(error.kind != .NONE);
free_json(*error);from_param :: (
$T: Type,
text: string,
options := Json_Options.{}
) -> (T, Json_Error)
Parameters
- $T: Type
- text: string
- options := Json_Options.{}
Returns
- T