Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
tanjaj
Contributor III
Contributor III

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": "urn0683p000009MA5A.pnggc:def:crs0683p000009MA5A.pngGC: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\":\"urn0683p000009MA5A.pnggc:def:crs0683p000009MA5A.pngGC: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:

I0683p000009M7HA.png

 

This is my job:0683p000009M7HK.png

 

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

0683p000009M7HP.png

 

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

 

BR,

Tanja

 

 

Labels (3)
1 Reply
Anonymous
Not applicable

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