Json.BoxedDeserializeFunc
Description: Reference for Json.BoxedDeserializeFunc

### Function

# JsonBoxedDeserializeFunc

#### Declaration

    gpointer
    (* JsonBoxedDeserializeFunc) (
      JsonNode* node
    )

#### Description [src]

Deserializes the contents of the passed `JsonNode` 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);
    }

Available since: | 0.10

#### Parameters

`node` | `JsonNode`
| A node tree representing a boxed data.
| The data is owned by the caller of the function.

#### Return value

Returns: | `gpointer`
| The newly created boxed structure.
| The data is owned by the called function.
| The return value can be `NULL`.