Liquid Studio 2021
Data Mapping / Data Mapper Functions / By Category / JSON / JSON Target
In This Topic
    JSON Target
    In This Topic
    Function Name
    JSON Data Target
    Category
    JSON
    Icon
    Description
    Allows data to be written to a JSON file.
    Inputs
    Filename

    If this connection point is connected then each value is used as the filename for the JSON document.
    Filenames must be local or UNC paths.
    Not visible in Simple View.

    Document

    A container for all the types of data the JSON Document can contain.
    Should not be connected to.
    Not visible in Simple View.

    Root (TYPE) The root node within the JSON document. Some JSON schemas allow the root node to be different type the root entry will exist for each allowable type. For each Document only one root should be provided with a value (as a document can not have more than one root node).
    Outputs
    Data The raw JSON data (does not need to be connected)
    Properties
    Default Target Uri The filename the JSON document will be written to (Ignored if the Filename input is connected or the Data output is connected).
    Encoding The text encoding applied to the JSON document
    Write BOM When true a UTF Byte Order Marker (BOM) is written at the start of the file.
    Execution Order If the transform contains multiple Output Components then this determines the order in which they are executed

    Debugging a Data Mapping Transform
    When you debug a data mapping using 'Start Debugging F5', the global application Encoding and BOM options are used. These settings can be changed in the application Options from the Tools menu:
    'Tools->Options->Environment->File Encoding' drop down list
    and
    'Tools->Options->Environment->Write Byte Order Marker (BOM)' checkbox

    Running a Data Mapping Transform
    When you run a data mapping using 'Execute Shift+F5' or when you generate source code (.dll) or an executable (.exe), the output component Encoding and BOM options are used.

    Usage

    Allows JSON documents to created within the Data Mapper.

    Creating an JSON data target

    To begin, drag the JSON Target component from the JSON section of the Component Palette onto a new Data Mapper file.

    This will cause the wizard to launch

     

    In order to write data to a JSON document, the Data Mapper needs to be aware of its structure.

    JSON Schema

    Loads the JSON Schema from the file specified.

    Infer a JSON Schema from a sample JSON document.

    If you don't have a JSON Schema then you can infer one from a sample JSON document, select this option and press next.

    This wizard page allows you to infer a JSON Schema from a sample JSON document.

    Sample JSON filename

    A JSON file containing data that is representative of the data you intend to load. The better the sample data the better the results.

    As far as possible ensure that the file contains all the possible combinations of data you expect to see, and try to show objects with and without optional fields.

    If your data is very complex you may need to refine the results afterwards using the JSON Schema Editor.

    JSON Schema filename

    The generated JSON Schema fill be written here.

    JSON Schema Encoding

    The encoding used to write the JSON Schema.

    Force Required

    Makes objects definitions required/mandatory if it that has not been identified as optional. If this is not set then all objects are declared as optional.

    Infer Enums

    When checked the values within objects and arrays are generated as Enumerated values using the unique values in the sample document.

    so if an array contained ["true", "false", "false", "false", "true" ] this would be inferred as an enumeration with the values "true", "false".

    This option works well on large sample documents, but on small sample sets it can cause the creation of values as enumerations, when in fact they should contain free text.

    Infer Enum Tolerance

    A tolerance factor for determining if a set of values can be considered an enumeration or free text.

    They will be considered an enumeration if (NoOfSamples/UniqueValues) > InferEnumTolorence.

    Array Rules

    Default Additional Items

    Indicates if additional items are allowed within the schemas definitions produced. This is a 3 state field.

    Default Additional Properties

    Indicates if additional properties are allowed within the schemas definitions produced. This is a 3 state field.

    Allows you to select the output location for the JSON data that this components represents.

    No default JSON Data

    No output filename has been provided so one must be provided within the transform using the 'Filename' input, the resulting JSON data will be written to the filename taken from the value of this input.

    Write JSON data to this file

    JSON Data is written to the filename provided (the filename can be an absolute path or can be a relative path which will be evaluated relative to the transform file)

     

    When the wizard is complete pressing the Finish button will created the JSON Target on the transform.

    To better understand the way in which the JSON schema is translated into the JSON Writer component, see How a JSON Schema is translated into a Data Mapper Component.

    The quality of the source JSON schema has a significant effect on the resulting JSON Writer Component, if the schema is poorly typed, then you will see a lot of duplicate entries (differing only by type).

    Simple View

    By default some of the lesser used properties of the writer are hidden, these can be shown again by right clicking and selecting "Toggle Simple View".

    Inputs

    The component has a root input called 'Filename', each value provided to this is treated as a filename and a new JSON document is created.

    If the 'Filename' input (and the 'Data' Output) is not connected then the "Default Target Uri" is used (see properties window).

    The child inputs are all specific to the JSON standard you selected when the component was created.

    Outputs

    The Data output returns the resulting JSON document as a string. This allows it to be consumed by other components rather than just being written to a file.

    If the Data output is connected the Default Target Uri property is ignored.

    It is an error to have connections to BOTH the Data output and the Filename input.

    See Also