JSON Extraction Function

A JSON Extraction Node allows you to extract from a column that has a JSON value only the desired property. Say we have the following example: Gender - Male, Age - 32, Profession - Athlete. If you select Age as a parameter, the result you'll get is 32.

We can see this node in action with the illustration of the use case below. Here, the node is extracting the customer ID from a column with JSON values into a new separated column:

Screenshot_2021-10-08_at_17.04.10.pngScreenshot_2021-10-08_at_17.06.53.png


Here’s a guide on how to add and set up a JSON Extraction Node: 

Understanding JSON Objects and arrays

JSON stands for JavaScript Object Notation, this is a syntax used for storing and exchanging data. There are two ways data can be stored in JSON, as objects or as arrays. 

This is a JSON Object

{
   "object": "value"
}

This is a JSON Array

[ 
   "value"
]

Despite of their visual representations being very alike, JSON Objects use key/value pairs to store their data, this values can be returned by calling their property. Meanwhile, the order of the Array determines the order of the information displayed. In other words, Array items are accessed using indices.

It is important to note that those two methods of storing data can be combined. Examples:

This is how an Array of Objects would look like:

[{ “position”: “winner”,”country”: “U.S.A” }, 
{ “position”: “runner”,”country”: “China” }
];
[{ “rainy”: true,”sunny”: false },
{ “rainy”: false,”sunny”: true }]

While this is the syntax for Object of arrays and objects

{ “binary”: [{“id”:1,”name”:0},{“id”:2,”name”:1}],
“boolean”: [{“id”:1,”value”: false},{“id”:2,”value”: true}]
}

And here it's how Nested Objects would look like

“results”: { “tennis”: [{“position”: “winner”,“country”: “U.S.A},
{“position”: “runner”,“country”: “China”}] }


Confused? It's ok! Watch the following video for more information and further explanation on this advanced node, or contact us for support.
JSON Extraction node explanation video


Note: In order to use the Model feature you already should have already imported data sources into Y42.

Setting up your JSON Extraction Node

  • Click on the JSON Extraction Node to apply the settings. 

    Screenshot_2020-12-11_at_2.46.38_PM.png

  • Select the Target Column you wish to modify or write the name of a new column.
  • Find the Source Column.
  • Choose the Column Type, e.g. Array of Nested Objects, Array of Objects, Nested Object, Object, Array.
  • Add your Property details. 
  • You can easily add other columns you want to extract by clicking on Add Condition, the big + button below.
  • When you are done, press Save.

Once you're done extracting your desired information, you can either perform further transformations or, if you want to export the new data table, click Commit Model.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.