# write_json

The `write_json` function writes a document to disk in JSON format. The document is appended to the file specified by the `JsonWriterFilename` argument.

## Syntax

    write_json( doc, JsonWriterFilename
       [, JsonWriterArchiveDirectory, JsonWriterMaxSizeKBs] )

## Arguments

Argument | Description
--- | ---
`doc` | (LuaDocument) The document to write to the JSON file.
`JsonWriterFilename` | (string) The filename of the output JSON file.
`JsonWriterArchiveDirectory` | (string) The path to the directory where JSON files are archived when they exceed the size specified by `JsonWriterMaxSizeKBs`.
`JsonWriterMaxSizeKBs` | (integer) The maximum size of JSON files, in kilobytes. When the file specified by `JsonWriterFilename` exceeds this size it is moved to the archive directory specified by `JsonWriterArchiveDirectory`. A timestamp is added to the file name so that it has a unique name.

## Returns

Boolean. Returns `true` if the file was created successfully, and `false` otherwise.

## Example

    function handler(document)
       write_json(document, "MyTask.jsn", "./JSONarchive", 1024 )
       return true
    end

_FT_HTML5_bannerTitle.htm