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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

csv file to json output

Hi,
I have a csv file having structure like
id, latitude, longitude
1,lat1,long1
1,lat2,long2
2,lat1,long1
3,lat1,long1
1,lat3,long3
here id is vehicle id and latitude and longitude are the coordinates of the vehicle. I want to produce a json file having structure like
{
"geometry": {
"coordinates": ,


]
},
"properties":{
"id": "1"
}
}
{
"geometry": {
"coordinates":
]
},
"properties":{
"id": "2"
}
}
{
"geometry": {
"coordinates":
]
},
"properties":{
"id": "3"
}
}
I have completed most of the part, but the main issue i am facing is creation of following '2D' array of vehicle co-ordinates.
,


]
Any pointer will be a great help 0683p000009MACn.png.
Regards
Sagar
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Can you tell what issue you are facing ?
I would probably use java/groovy Code comp. to create and format the Json model you are expecting.
Csv input ->filter rows based on id-> execute java code to create Json str->store temp result in buffer .
Anonymous
Not applicable
Author

Hi,
Thanks for the response, basically i am using "tWriteJSONField" to create json objects.
it works good first time but when i tried to use it in chain all values other than o/p of first "tWriteJSONField" becomes "null".
pls find attached screen shot of the job.
Anonymous
Not applicable
Author

forgot to attach screen shot 0683p000009MACn.png, pls find it.
_AnonymousUser
Specialist III
Specialist III

Can you please share the screenshot for the XML tree for tWriteJSONField components?