### Function

# Json gobject_to_data

#### Declaration [src]

    gchar*
    json_gobject_to_data (
      GObject* gobject,
      gsize* length
    )

#### Description [src]

Serializes a `GObject` instance into a JSON data stream, iterating recursively over each property.

If the given object implements the `JsonSerializable` interface, it will be asked to serialize all its properties; otherwise, the default implementation will be use to translate the compatible types into JSON native types.

Available since: | 0.10

#### Parameters

`gobject` | `GObject`
| The object to serialize.
| The data is owned by the caller of the function.
`length` | `gsize*`
| Return value for the length of the buffer.
| The argument will be set by the function.
| The argument can be `NULL`.

#### Return value

Returns: | `gchar*`
| A JSON data stream representing the given object.
| The caller of the function takes ownership of the data, and is responsible for freeing it.
| The value is a NUL terminated UTF-8 string.