Combining JSON output into a single field

Shawn_21372
Shawn_21372 Altair Community Member
edited May 2023 in Community Q&A
Hi,
 
I have a file with data in JSON format that is an output from a Dataprep Studio workspace.  I would like to combine this output into a single field which would eventually be appended with another file that is being ingested into a database table.  Here is an example of the JSON file:
 
[ 	{ 		"Field1": "1", 		"Field2": "2", 	}, 	{ 		"Field1": "1", 		"Field2": "2", 	} ]
 
Here is an example of the final format that would be loaded to a database table:
 
Field1 Field2 JsonOutput Field4
Some value 2 [
    {
        "Field1": "1",
        "Field2": "2",
    },
    {
        "Field1": "1",
        "Field2": "2",
    }
]
Some Value
 
Is there any way out of the box I can combine the JSON file into a essentially a single field?
 
Thanks!
Tagged:

Answers

  • Baba_Majekodunmi_703
    Baba_Majekodunmi_703
    Altair Employee
    edited May 2023

    Hi Shawn,

    Great question. I have made an attempt to simulate this. Here's what I did.

    1. I created a classic model to capture the data from the JSON file like a text file.
    2. I then used the data prep studio functions to clean it up to extract a unique identifier (in this case Account Number)
    3. Finally I joined the two tables together.

    Not sure if this is exactly what you're looking for, but I hope it at least gives you some ideas. I've attached the files a well as a reference.

    image