How-To: Import a JSON File into the Intelligence Hub via the File Connection

What Does This Article Cover?


This article provides Conditions that one can use in order to input JSON files into the Intelligence Hub through the File Connection.

The Intelligence Hub’s File Connection does not inherently support reading in JSON files. However, you can condition the file input in order to access the contents of the JSON file. By default, when a JSON file is read into the intelligence Hub via the File connector the contents of the file are displayed and interpreted in binary format.

This article will provide two custom Conditions that can be used to read in JSON files. One Condition will be for reading in a JSON file through the File Connector when ‘include Metadata’ is turned off and another will be provided for when ‘include Metadata is’ is turned on. By applying the appropriate Custom Condition from this article, the binary data from the input will be conditioned to JSON format.

What is a Condition?

Conditions are a way to manipulate raw data read from an input. There are several types of conditions you can take advantage of in the Intelligence Hub. In this scenario we will be using a ‘Custom Condition’.

In the Conditions included in this article you will notice the {{this.currentValue}} syntax. {{this.currentValue}} resolves to the current value of the source being read. In this scenario it will resolve to the JSON file in binary format.

Step By Step Guide to Conditioning

  1. Ensure your File connection to your JSON is set up properly

    • By clicking test read you will notice that the results are displayed in Base64

  1. Creating a new Custom Condition : Details
  • Navigate to Conditions and click ‘New Condition’
  • Name your condition and click ‘Next’
  1. Creating a new Custom Condition : Settings
  • Select ‘Custom’ as Condition Type.
  • Using the reference panel on the right side of the GUI select Input as Type and your file connection under connections
  • Drag your input reference to ‘Sources’ box
  1. Paste the appropriate expression into the ‘Expression’ box
  • If the ‘Include Metadata’ option is disabled:

    javascript
     JSON.parse({{this.currentValue}}.utf8String)
  • If the ‘Include Metadata’ Option is enabled:

    javascript
    JSON.parse({{this.currentValue}}.value.utf8String)

  1. Click ‘Submit’ and Test your condition

By using the appropriate condition, the Intelligence Hub can interpret the JSON data, whether “Include Metadata’ is toggled on or off.