BoxedDeserializeFunc


Description:

[ CCode ( has_target = false ) ]
[ Version ( since = "0.10" ) ]
public delegate void* BoxedDeserializeFunc (Node node)

Deserializes the contents of the passed `JsonNode` into a `GBoxed`, for instance:

```c static gpointer my_point_deserialize (JsonNode *node) { double x = 0.0, y = 0.0;

if (JSON_NODE_HOLDS_ARRAY (node)) { JsonArray *array = json_node_get_array (node);

if (json_array_get_length (array) == 2) { x = json_array_get_double_element (array, 0); y = json_array_get_double_element (array, 1); } } else if (JSON_NODE_HOLDS_OBJECT (node)) { JsonObject *obj = json_node_get_object (node);

x = json_object_get_double_member_with_default (obj, "x", 0.0); y = json_object_get_double_member_with_default (obj, "y", 0.0); }

// my_point_new is defined elsewhere return my_point_new (x, y); } ```

Parameters:

node

a node tree representing a boxed data

Returns:

the newly created boxed structure


Namespace: Json
Package: json-glib-1.0



2022 vala-language.org