Connector Framework Server 12.11

# 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

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.11 | Last updated February 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Connector Framework Server 12.11

Topic Title: write_json