Importing data from Map to JSON output file

Highlighted
Five Stars

Importing data from Map to JSON output file

Hi guys,

I need help about this case....

I've imported data from xml file, did some calculations and now i want to store data in JSON file in structure like this:

{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urnSmiley Surprisedgc:def:crsSmiley SurprisedGC:1.3:CRS84"
}
},
"features": [
{
"type": "Feature",
"properties": {
"city": "Bratislava - Staré Mesto",
"county": "Bratislava I",
"region": "Bratislavský",
"latitude": 48.140589,
"longitude": 17.112327
},
"geometry": {
"type": "Point",
"coordinates": [
17.112327,
48.140589
]
}
},

----------------------------------------------------------------------------------------------

This is what i get:

----------------------------------------------------------------------------------------------

[
{
"type3": null,
"type2": null,
"city": "{\"type\":\"FeatureCollection\",\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"urnSmiley Surprisedgc:def:crsSmiley SurprisedGC:1.3:CRS84\"}},\"features\":{\"type\":\"Feature\",\"properties\":{\"city\":\"Praha\",\"county\":[],\"region\":\"Hlavní město Praha\",\"latitude\":\"50.08455284219091\",\"longitude\":\"14.417782158070091\"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[\"50.08455284219091\",\"14.417782158070091\"]}}}",
"latitude": null,
"name": null,
"county": null,
"region": null,
"type": null,
"type1": null,
"longitude": null
},

I don't need these columns with null and I don't know how to get rid of them.

 

This is what i have in tWriteJSONFile:

ICapture4.PNG

 

This is my job:Capture2.PNG

 

And this is my output file and i think that here is the problem,but just don't know how to resolve it.

Capture5.PNG

 

if you have any idea i would be more than grateful.

 

BR,

Tanja

 

 

Moderator

Re: Importing data from Map to JSON output file

Hello,

Please try to replace null with another data or handle the string further after tWriteJSONFile.

Maybe you could add a tJavaRow after tWriteJSONField and do this: output_row.output = input_row.output.replaceAll(",\"*\":\\", "");

Let us know if it helps.

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Enabling Data Governance

Learn how to enable Data Governance

Watch Now

The Definitive Guide to Government Data Quality

Take a peek at the definitive guide to Government Data Quality

Read