Parsable.from_json


Description:

[ CCode ( has_construct_function = false ) ]
[ Version ( since = "0.15.0" ) ]
public Parsable.from_json (Type parsable_type, string json, int length) throws Error

Creates a new Parsable subclass (of the given parsable_type) from the given json.

An object of the given parsable_type is created, and its <function>parse_json</function> and <function> post_parse_json</function> class functions called on the JSON node obtained from json. <function>post_parse_json </function> is called once on the root node, while <function>parse_json</function> is called for each of the node's members.

If length is -1, json will be assumed to be nul-terminated.

If an error occurs during parsing, a suitable error from ParserError will be returned.

Parameters:

parsable_type

the type of the class represented by the JSON

json

the JSON for just the parsable object

length

the length of json, or -1

Returns:

a new Parsable, or null; unref with unref