K3 Documents

JSON Upload Adaptor

Updated on

The K3 JSON Upload Adaptor allows data to be processed whenever a JSON file is uploaded from the Data Stream page. 

Below you will find details on how to configure this adaptor. 

JSON Upload Adaptor

1. Select the JSON Upload adaptor and add sample data

Once you select the JSON Upload adaptor, enter a sample of your data so that K3 can assist you in configuring the route. Click Add Sample Data to begin.

2. Upload or paste sample data 

Sample data can be input by either dragging a file or pasting data into the box on the left.

3. Review uploaded data and determine JSONPath

Once sample data is uploaded, K3 will attempt to determine all of the fields for your dataset. The right panel will tell you how many fields were parsed for a particular JSONPath. CONFIGURE FIELDS will highlight for the JSONPath that is most likely to be of interest.


Click the CONFIGURE FIELDS button for the appropriate JSONPath to move on to the next step.

4. Select fields to capture

The Configure Fields step allows you to select the fields from the JSON sample data to include. The fields are outlined on the left side of the screen. Clicking a field will move it to the right panel, indicating that this is a field that should be parsed.


K3 will display an example field name derived from the path, which can be modified. This is the field name that will show up in K3, so reviewing and providing clear field names is recommended. The JSONPath used to parse the field will be displayed and in most cases should not be modified.


Note that K3 makes its best guess at the field types, so you might need to make some modifications based on your knowledge of the data.


Once you are satisfied, click OK in the bottom right to move on.


As an additional note, you can click Add All Candidates to add all parsable fields rather then selecting each field.

Configuration Parameter Description
Field Name This is the K3 field name corresponding to a field in your JSON file. This is the name of the field that will be used in the K3 Source data. K3 will default a field name which you can modify. 
Field Type This is the K3 field type corresponding to a column in your JSON file. K3 will recommend a field type, which you can modify.
JSONPath This is the JSONPath statement used to parse this specific field based on the JSON file. It is not recommended to change this unless you have a good understanding of JSONPath parsing.

5. Select Metadata fields to capture

Once you have selected the detail fields to capture from the JSON, you might have the option to select Metadata or header level fields to parse.  Click Configure Meta JSONPaths ($) to start this process.

 

Select the metadata fields desired and specify the name and data types, just as you did in the previous step.

 

Configuration Parameter Description
Field Name This is the K3 field name corresponding to a field in your JSON file. This is the name of the field that will be used in the K3 Source data. K3 will default a field name which you can modify. 
Field Type This is the K3 field type corresponding to a column in your JSON file. K3 will recommend a field type, which you can modify.
JSONPath This is the JSONPath statement used to parse this specific field based on the JSON file. It is not recommended to change this unless you have a good understanding of JSONPath parsing.

6. Date Formats and Finalizing Configuration

The final step is to determine Date/DateTime formats, which K3 uses to parse strings representing Date/DateTime values. K3 will attempt to suggest formats that are appropriate for your data, but you might need to provide custom formats by clicking + Add below the Date/Date Time sections. Keep in mind that multiple formats are allowed and K3 will attempt to parse any value in the order that the formats are specified.


If you find that Date/DateTime field values are missing in Data Stream, you might need to return to this page to review the formats specified below. 

Configuration Field Value
Date Enter the format of Date fields in the JSON so that K3 can parse it properly.

Examples:
yyyy-MM-dd -> 1978-05-28
yyyyMMdd -> 19780528
MM/dd/yyy -> 05/28/1978
Date Time Enter the format of DateTime fields in the JSON so that K3 can parse it properly.

Examples:
yyyy-MM-dd'T'HH:mm:ss.SSSZ -> 1978-05-28T09:07:21.201-07:00
yyyy-MM-dd'T'HH:mm:ss.SSS -> 1978-05-28T09:07:21.201
yyyy-MM-dd'T'HH:mm:ssZ -> 1978-05-28T09:07:21-07:00

7. Save the route

Click Save on the top right side to save the route configuration.

8. Automatic source field import

Once you create the route, you will be navigated to the "Source Fields" dialog with your fields ready to be created. Click SAVE to create the fields.

9. Apply and Restart

Once you make a change to the route, whether it is adding fields or mappings, you must click Apply and Restart  on the top right side of K3. This process tells K3 that you are ready to use the new data, mappings and rules. 

10. Uploading Data for Processing

Once an upload route is configured, you can upload data to that that route in the Data Stream. Select Data Stream for the route you have created, then click the ellipsis on the right hand side of the data table to upload your file. 

Previous Article CSV Upload Adaptor
Next Article XML Upload Adaptor