### Method

# Json Generator to_file

#### Declaration [src]

    gboolean
    json_generator_to_file (
      JsonGenerator* generator,
      const gchar* filename,
      GError** error
    )

#### Description [src]

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

This operation is atomic, in the sense that the data is written to a temporary file which is then renamed to the given `filename`.

#### Parameters

`filename` | `const gchar*`
| The path to the target file.
| The data is owned by the caller of the function.
| The value is a file system path, using the OS encoding.
`error` | `GError **`
| The return location for a `GError*`, or `NULL`.

#### Return value

Returns: | `gboolean`
| `TRUE` if saving was successful.