Function

Jsongvariant_deserialize_data

since: 0.14

Declaration [src]

GVariant*
json_gvariant_deserialize_data (
  const gchar* json,
  gssize length,
  const gchar* signature,
  GError** error
)

Description [src]

Converts a JSON string to a GVariant value.

This function works exactly like json_gvariant_deserialize(), but takes a JSON encoded string instead.

The string is first converted to a JsonNode using JsonParser, and then json_gvariant_deserialize is called on the node.

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

Available since: 0.14

Parameters

json

Type: const gchar*

A JSON data string.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
length

Type: gssize

The length of json, or -1 if NUL-terminated.

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 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 GVariantD compliant.

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