BoxedDeserializeFunc

Deserializes the contents of the passed json.node.Node into a GBoxed, for instance:

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);
}
alias BoxedDeserializeFunc = void* delegate

Return Value

the newly created boxed structure