If you work with data from web apps or APIs, then you are most likely familiar with the JSON data format. JSON stands for JavaScript Object Notation and it has become a popular method of storing data all over the web. Previously there was not an easy way to read a JSON file in SPSS Modeler. It is very exciting that there is a brand new extension on the IBM Predictive Analytics GitHub that can perform this task!

jsonExt
Below is a guide for using this extension for the first time. For this example, we will read a JSON file that is saved here.

Step by Step Guide

  1. In SPSS Modeler v16.0 or 17.0, it is not possible to create proper ‘source’ nodes with R code. However it is possible if you trick the software a bit: you just have to put a user input with fake fields before the Read JSON File node in order to make the stream start. In this example we put a User Input node with: Field a; Storage String; Values “a” (see the screenshot below).
  2. UserInput

  3. The “Read JSON File” node should be saved in the Field Ops palette when it is installed. Double click on this node to add it to the stream.
  4. Edit the node and fill in the fields:
  5. Browse for a File: choose the JSON file you want to import
    Specified path to array: Check the box if your JSON file is not an array. Then, specify the path to the array you want to display in your table. In our example the path would be “id_array”.

    DialogBox

  6. Add an output node after the “Read JSON File” node, in order to visualize the data you gathered. For example you can start with a ‘Table’.
  7. Right click on the table and run the stream

Results and Interpretation
Your results should match the table below:
OutputTable

Below is a video walk through for this sample use case for this new extension:

For more information on using this extension, please see the documentation located here.

8 comments on"How to Read a JSON File in SPSS Modeler"

  1. Paul McQuesten August 03, 2015

    +1 Thanks!!

  2. Thank you very much; I will try this and get back to you if any problem arises.

  3. Hi,

    Has this feature been implemented as part of Modeler 18 release ?

  4. Saleem Shaikh May 21, 2017

    I am getting error that data and data model does not match

  5. yea me too. I am trying to import a json file from Watson Discovery and I get the data and data model does not match.

  6. Tamer Salama January 13, 2018

    I’ve updated the issue at – still having problems https://github.com/IBMPredictiveAnalytics/Read_JSON_File/issues/6

Join The Discussion

Your email address will not be published. Required fields are marked *