### Function

# Json gvariant_deserialize

since: 0.14

#### Declaration [src]

    GVariant*
    json_gvariant_deserialize (
      JsonNode* json_node,
      const gchar* signature,
      GError** error
    )

#### Description [src]

Converts a JSON data structure to a `GVariant`.

If `signature` is not `NULL`, it will be used to resolve ambiguous data types.

If no error occurs, the resulting `GVariant` is guaranteed to conform to `signature`.

If `signature` is not `NULL` but does not represent a valid `GVariant` type string, `NULL` is returned and the `error` is set to `G_IO_ERROR_INVALID_ARGUMENT`.

If a `signature` is provided but the JSON structure cannot be mapped to it, `NULL` is returned and the `error` is set to `G_IO_ERROR_INVALID_DATA`.

If `signature` is `NULL`, the conversion is done based strictly on the types in the JSON nodes.

The returned variant has a floating reference that will need to be sunk by the caller code.

Available since: 0.14

#### Parameters

`json_node`

  Type: `JsonNode`

  The node to convert.

  The data is owned by the caller of the function.

`signature`

  Type: `const gchar*`

  A valid `GVariant` type string.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GVariant`

A newly created `GVariant`

The data is owned by the called function.
The return value can be `NULL`.