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()`.

since: 0.14

###### json_generator_get_indent_char

Retrieves the value set using `json_generator_set_indent_char()`.

since: 0.14

###### json_generator_get_pretty

Retrieves the value set using `json_generator_set_pretty()`.

since: 0.14

###### json_generator_get_root

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

since: 0.14

###### json_generator_set_indent

Sets the number of repetitions for each indentation level.

since: 0.14

###### json_generator_set_indent_char

Sets the character to be used when indenting.

since: 0.14

###### json_generator_set_pretty

Sets whether the generated JSON should be pretty printed.

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.

since: 1.4

###### json_generator_to_stream

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

since: 0.12

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### 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.

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.

since: 0.4

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

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

    }

No description available.

###### 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.