Output Format "InternalJson"
This output format generates a JSON file in the program-internal representation form of the document as determined within the program (i.e., as is also used for storage in MongoDB as an administrative database). In addition, the file attachments of the document can be embedded, or references to file attachments to be accompany it externally can be generated.
The output format "InternalJson" primarily serves the purposes of testing and analysis. You can use it to view the contents of a document after processing. However, the format can also be used to send a document from one xSuite Interface processing scenario to another of the same or a different program instance. This is done by sending the document via the "File" output system of one scenario, for instance, to the "File" input system of the other scenario.
Notice
Do not use the "File" input and output systems for transferring a document within the same program instance. Instead, use the input system "Internal" and the output system "Internal".
Property | Description |
|---|---|
OutputFormat[].AttachFileMode | Mode determining how accompanying file attachments are added to the JSON file:
|
OutputFormat[].AttachFileRefMacro | Macro expression for formatting the file reference value in The default value is preset with the expression |
In the following example, the variable "FileUuid" is used to generate the file reference, in deviation from the default setting. This can be a useful variant, especially when using this output format to transfer data to another scenario. This ensures that the names of the file references generated do not collide with each other or with those of existing output files.
In the context of the output format, however, only the references to the file attachments will be generated. The actual physical output of the file attachments must be done separateley, using a subsequent output system (for example, via the output system "File" into the file system). In the configuration, always ensure that the files are actually output under the same names as in the references.
Example
A consistent configuration might look like the following, for example:
"OutputFormat":
[
{
"Type": "InternalJson",
"FileName": "internal.json",
"AttachFileMode": "Reference",
"AttachFileRefMacro": "'%FileUuid%.%FileExt%'"
}
],
"OutputSystem": [
{
"Type": "File",
"OutputFileMacro": "IfElse(@FileName == 'internal.json',
@FileName, '%FileUuid%.%FileExt%\')"
}
]In the .AttachFileRefMacro and .OutputFileMacro properties, the same expression is used here for the output format and the output system to determine the file name. For the output system, the name is included in an additional query so that, while the file itself retains its original name, this naming applies only to the referenced file attachments in the document.json file. In the event of a possible re-read of the file attachments by an "InternalJson" input format, the original file names (not just the references with deviating naming) are also implicitly passed on. In this way, the original names of the file attachments are retained.
Deviating from the standard, for the output format "InternalJson" no fields to be output need to be defined via the property OutputFormat[].Field[], since the generated JSON file basically includes all fields of the document. Only the file attachments to be included can be restricted. For this purpose, you can use either the property .AttachFileMode or the general property .AttachFileFilter.
To be able to re-read the output data generated in the above example with another scenario, the scenario must use an input system of the type "File" in which the primary file document.json is selected. To add the file attachments that are embedded or referenced in this file, an input format "InternalJson" is required. To read the index fields, an index data reader of the type "InternalJson" is required. The JSON output file originally generated from the document content contains a number of internal properties and key values that have no relevance for the use case of re-reading the document. This amounts to new document object being generated with newly generated key values. Only the contents of the file attachments and index fields (i.e., the contents of the file attachments and index fields) are transferred from the original document.