Read a JSON File

To map data from a JSON code snippet to your process schema, do the procedure in this topic.

Figure: JSON Reader Template Configuration screen

JSON Reader Template Configuration screen
Figure: JSON Reader Schema Configuration screen

JSON Reader Schema Configuration screen

Prerequisites

Good to Know

How to Start

  1. Open Process Builder.

    For information about how to open this screen, refer to Process Builder.


    Open Process Builder
  2. Do one of these:
    • Add an activity:
      1. In Process Builder, in the Activity Library, open the Document tab.

        Document tab
      2. On the Document tab, drag the Read JSON activity onto your process.

        Read JSON activity
    • Change an activity:
      1. In your process, double-click your activity.

Procedure

  1. Complete the fields on the General Configuration screen.
  2. Click Source Configuration Source Configuration icon.
  3. On the Source Repository screen, select the source location of your JSON code snippet to map the values in your process schema.
  4. Click JSON Reader Configuration JSON Reader Configuration icon.
  5. On the JSON Reader Template Configuration screen, complete these fields as necessary.
    Field NameDefinition

    JSON Source

    Description:
    Specifies the JSON code snippet to connect to your process.
    Allowed Values:
    A valid JSON code snippet.
    Default Value:
    None
    Example:
    //Storing data:
    myObj = { "name":"John", "age":31, "city":"New York" };
    myJSON = JSON.stringify(myObj);
    localStorage.setItem("testJSON", myJSON);

    Load

    Description:
    Runs the JSON code to get data from the external service.
    To Open this Field:
    • On the JSON Reader Selection Configuration screen, select Read JSON Runtime Payload From Source Repository.
  6. Click JSON Reader Schema Configuration JSON Reader Schema Configuration icon.
  7. On the JSON Reader Template Configuration screen, complete this field as necessary.
    Field NameDefinition

    Mapping Schema

    Description:
    Connects the schemas to your process schema.

    The source and the destination schemas show in a tree view in the left and right panes.

    Allowed Values:
    Read only - However, the drag and drop operations are supported to map the schemas.

    Drag a data node from the source schema pane to the destination schema pane:

    • Green line - The data type of source and destination nodes matches.
    • Blue line - The data type of source and destination nodes doesn't match. The data conversion is required to map the schemas.
    • Red line - Specifies that the custom data conversion is required.
    Example:
    Refer to:
  8. (Optional) Complete these fields as necessary.
    Field NameDefinition

    AutoMap

    Function:
    Maps all fields in the data source and the process schema that have the same name.
    Example:
    Refer to:

    Reset

    Function:
    Deletes all connections that have been made in the Schema Mapper for this activity.

    Data Conversion

    Description:
    Specifies the data conversion between the source and the destination schema fields.
    Allowed Values:
    • No Data Conversion Needed - The data type of the source schema elements matches the data type of the target schema elements, or no data type conversion is necessary.
    • Default Conversion - The data type of the source schema elements does not match the data type of the target schema elements. This option uses a default conversion methodology.
    • Custom Data Conversion - Uses a data conversion method you specify.

      If you specify a custom data conversion method, it must return the results in valid XML format.

    Default Value:
    No Data Conversion Needed
    Example:
    Refer to:

    Add

    Opens this Screen:
    Custom Mapping screen
    Function of this Screen:
    Specifies custom C# code that can be used to map fields to an XML schema.
    Example:
    Refer to:

    Edit

    Opens this Screen:
    Custom Mapping screen
    Function of this Screen:
    Specifies custom C# code that can be used to map fields to an XML schema.

    Delete

    Function:
    Deletes the selected custom data conversion from the list.

    Reload

    Function:
    Runs the JSON code to connect the data again.