esProc Joins a Structured Text file with a JSON File

structure.txt is a tab-separated structured text file. json.txt contains non-structured JSON strings. We need to join the two files to create a new file result.txt. The original data is as follows.







esProc will first import json.txt as a structured table sequence and then join it with structure.txt. The code is as follows:


A1: Import the JSON file into the memory as a table sequence.
A2: Retrieve name column and cluster column from it. #1 represents the first column. Result is as follows:


A3: Split cluster column into two parts, name them key and value respectively and thus generate a structured data object. Result is as follows:


A4: Import the structured text file.

A5: Perform join operation. _2 represents A4’s second column. Result is as follows:



A6,B7: Retrieve desired columns and export them to result.txt.


About datathinker

a technical consultant on Database performance optimization, Database storage expansion, Off-database computation. personal blog at: datakeywrod, website: raqsoft
This entry was posted in esProc/R/Python/Perl, Structured Data Process and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s