Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
devanpeebles
Contributor III
Contributor III

Handling Complex JSON Strcutures

We're starting to work quite a bit with more complex JSON structures, IE multiple nested arrays etc...  typically we're creating these from relational data sources and shredding them back into that.

 

I was just using an approach of chaining tWriteJsonField or tExtractJSONField to create them, is there a better way to do so?

 

0683p000009M9h2.jpg

 

Which gets me what I want,

 

[
{
"KEY": "1",
"COL_TWO": "ROOT_RECORD",
"CHILD_JSON": [
{
"COL_ONE": "dfgsdfg"
},
{
"COL_ONE": "xcvbxcvb"
}
]
}
]

 

 

 

 

 

 

1 Solution

Accepted Solutions
Anonymous
Not applicable

The Data Mapper gives you better functionality for multiple loops, arrays, etc. As I said, it is a tricky tool to get to grips with, but once you understand it is very useful. I would recommend taking a Talend Data Mapper course to get to grips with it.

View solution in original post

8 Replies
Anonymous
Not applicable

If you have the subscription version you can use Talend Data Mapper. This is a better way of dealing with complex JSON structures, but can be quite a learning curve if you've never used it before. If you are using the Open Source product, then the way you are doing this is fine. Some people might be inclined to build more complex JSON using Java (since this is an option for people with Java skills), but from what I have seen you are approaching this in a reasonable way.

devanpeebles
Contributor III
Contributor III
Author

Thank you for the reply.

 

We do have real time big data version so we do have access to the data mapper.  What would be the advantages of the data mapper in this case?  I was looking at trying to use it but it didn't quite seem to work in this case where we're trying to map in multiple data flows that are a relational structure(or inversely shred json out into a relational structure).  

manodwhb
Creator III
Creator III

Using Talend data mapper you can convert XML to Json, structure to Jason and many things. It would give more flexible to convert into hirachial mappings.
Anonymous
Not applicable

The Data Mapper gives you better functionality for multiple loops, arrays, etc. As I said, it is a tricky tool to get to grips with, but once you understand it is very useful. I would recommend taking a Talend Data Mapper course to get to grips with it.

devanpeebles
Contributor III
Contributor III
Author

Thanks for the feedback both of you, we'll be looking at the datamapper in the future.

 

For now the solution we have seems to work for what we need.

Anonymous
Not applicable

@rhall 

Currently I have 2 csv files and I expect the first is the json file according to the image I sent. Currently I have not thought of a solution. Can you help me    

0683p000009MZrv.png0683p000009MZs0.png0683p000009MZia.png

devanpeebles
Contributor III
Contributor III
Author

What are you trying to do?  Merge the two csv's into a json structure?

Anonymous
Not applicable

Yes, I merged 2 csv files into json files in an integrated structure. But I have found a solution. I have followed tJSONDoc
https://jan-lolling.de/talend/components/help/tJSONDoc.pdf

Thank you.