Open topic with navigation

# 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

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close Send Documentation Feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to AutonomyTPFeedback@hpe.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm