Json.Generator
Description: Reference for Json.Generator

### Class

# JsonGenerator

#### Description [src]

    class Json.Generator : GObject.Object {
      /* No available fields */
    }

`JsonGenerator` provides an object for generating a JSON data stream from a tree of `JsonNode` instances, and put it into a buffer or a file.

#### Ancestors

- GObject

#### Constructors

###### json_generator_new

Creates a new `JsonGenerator`.

#### Instance methods

###### json_generator_get_indent

Retrieves the value set using `json_generator_set_indent()`.

Available since: 0.14

###### json_generator_get_indent_char

Retrieves the value set using `json_generator_set_indent_char()`.

Available since: 0.14

###### json_generator_get_pretty

Retrieves the value set using `json_generator_set_pretty()`.

Available since: 0.14

###### json_generator_get_root

Retrieves a pointer to the root node set using `json_generator_set_root()`.

Available since: 0.14

###### json_generator_set_indent

Sets the number of repetitions for each indentation level.

Available since: 0.14

###### json_generator_set_indent_char

Sets the character to be used when indenting.

Available since: 0.14

###### json_generator_set_pretty

Sets whether the generated JSON should be pretty printed.

Available since: 0.14

###### json_generator_set_root

Sets the root of the JSON data stream to be serialized by the given generator.

###### json_generator_to_data

Generates a JSON data stream from `generator` and returns it as a buffer.

###### json_generator_to_file

Creates a JSON data stream and puts it inside `filename`, overwriting the file’s current contents.

###### json_generator_to_gstring

Generates a JSON data stream and appends it to the string buffer.

Available since: 1.4

###### json_generator_to_stream

Outputs JSON data and writes it (synchronously) to the given stream.

Available since: 0.12

#### Properties

###### Json.Generator:indent

Number of spaces to be used to indent when pretty printing.

###### Json.Generator:indent-char

The character that should be used when indenting in pretty print.

Available since: 0.6

###### Json.Generator:pretty

Whether the output should be “pretty-printed”, with indentation and newlines.

###### Json.Generator:root

The root node to be used when constructing a JSON data stream.

Available since: 0.4

#### Class structure

    struct JsonGeneratorClass {
      void (* _json_reserved1) (
    void
      );
      void (* _json_reserved2) (
    void
      );
      void (* _json_reserved3) (
    void
      );
      void (* _json_reserved4) (
    void
      );

    }

###### Class members

`_json_reserved1` |
    void (* _json_reserved1) (
    void
      )
| No description available.
`_json_reserved2` |
    void (* _json_reserved2) (
    void
      )
| No description available.
`_json_reserved3` |
    void (* _json_reserved3) (
    void
      )
| No description available.
`_json_reserved4` |
    void (* _json_reserved4) (
    void
      )
| No description available.