Connector Framework Server 25.2
Connector Framework Server Help

# 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 2025 Open Text
Version 25.2 | Last updated April 2025

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Connector Framework Server 25.2

Topic Title: write_json