Declaration [src]

json_gobject_from_data (
  GType gtype,
  const gchar* data,
  gssize length,
  GError** error

Description [src]

Deserializes a JSON data stream and creates an instance of the given type.

If the type implements the JsonSerializable interface, it will be asked to deserialize all the JSON members into their respective properties; otherwise, the default implementation will be used to translate the compatible JSON native types.

Note: the JSON data stream must be an object.

Available since:0.10


gtype GType

The type of the object to construct.

data const gchar*

A JSON data stream.

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

Length of the data stream, or -1 if it is NUL-terminated.

error GError **
  The return location for a GError*, or NULL.

Return value

Returns: GObject*

A new object instance of the given type.

 The caller of the function takes ownership of the data, and is responsible for freeing it.
 The return value can be NULL.