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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
gadje1
Creator
Creator

Json from tMap with tFileOutputJSON

Hello,
i would like be able to change data from tMap into Json format.
For this, i used the component tFileOutputJSON. But the result is not like what i would. I just have the last result from my query, the other are not in the Json file and the structure of the Json file is wrong.

 

Here is my job structure :

0683p000009M8kx.jpg

Here is my tMap structure :

0683p000009M8l2.jpg

 

And  my json structure result is like that :

 

[{"departement":"29","numero":"29021","video1":"AD021_VID1.mp4","titre":null,"latitude":null,"photo6":"AD021_IMG6.jpg","photo7":"AD021_IMG7.jpg","photo8":"AD021_IMG8.jpg","photo9":"AD021_IMG9.jpg","photo2":"AD021_IMG2.jpg","nom":"DILASSER","photo3":"AD021_IMG3.jpg","photo4":"AD021_IMG4.jpg","photo5":"AD021_IMG5.jpg","photo10":"AD021_IMG10.jpg","logo":"AD021_LOGO.png","tel":"02 98 72 85 89","id":"AD021","fax":"02 98 72 90 08","email":"ODILASSER@DILASSER.COM","longitude":null,"code_postal":"29610","ville":"PLOUIGNEAU","adresse_1":"","recherche":"29610+","adresse_2":"ZA de KERVANON","vilcl":null,"photo1":"AD021_IMG1.jpg","information":null}]

Instead that :

[
	{
		"departement":"29",
		"numero":"29021",
		"video1":"AD021_VID1.mp4",
		"titre":null,
		"latitude":null,
		"photo6":"AD021_IMG6.jpg",
		"photo7":"AD021_IMG7.jpg",
		"photo8":"AD021_IMG8.jpg",
		"photo9":"AD021_IMG9.jpg",
		"photo2":"AD021_IMG2.jpg",
		"nom":"DILASSER",
		"photo3":"AD021_IMG3.jpg",
		"photo4":"AD021_IMG4.jpg",
		"photo5":"AD021_IMG5.jpg",
		"photo10":"AD021_IMG10.jpg",
		"logo":"AD021_LOGO.png",
		"tel":"02 98 72 85 89",
		"id":"AD021",
		"fax":"02 98 72 90 08",
		"email":"ODILASSER@DILASSER.COM",
		"longitude":null,
		"code_postal":"29610",
		"ville":"PLOUIGNEAU",
		"adresse_1":"",
		"recherche":"29610+",
		"adresse_2":"ZA de KERVANON",
		"vilcl":null,
		"photo1":"AD021_IMG1.jpg",
		"information":null},
	},
		{
		"departement":"29",
		"numero":"29021",
		"video1":"AD021_VID1.mp4",
		"titre":null,
		"latitude":null,
		"photo6":"AD021_IMG6.jpg",
		"photo7":"AD021_IMG7.jpg",
		"photo8":"AD021_IMG8.jpg",
		"photo9":"AD021_IMG9.jpg",
		"photo2":"AD021_IMG2.jpg",
		"nom":"DILASSER",
		"photo3":"AD021_IMG3.jpg",
		"photo4":"AD021_IMG4.jpg",
		"photo5":"AD021_IMG5.jpg",
		"photo10":"AD021_IMG10.jpg",
		"logo":"AD021_LOGO.png",
		"tel":"02 98 72 85 89",
		"id":"AD021",
		"fax":"02 98 72 90 08",
		"email":"ODILASSER@DILASSER.COM",
		"longitude":null,
		"code_postal":"29610",
		"ville":"PLOUIGNEAU",
		"adresse_1":"",
		"recherche":"29610+",
		"adresse_2":"ZA de KERVANON",
		"vilcl":null,
		"photo1":"AD021_IMG1.jpg",
		"information":null},
	}
	
	...
]

If somebody knows how to do ...

Thanks a lot.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

From your job screenshot, I see you use a tFlowToIterate to iterate each input row, that's why it override the output file and only has the last record. If you want to output all records in one file, change the job to like:
.....tMap1-->tHashOutput1
|onsubjobok
tHashInput1--main--tFileOutputJson

on tHashOutput1: make sure the 'Append' box is checked.
tHashInput1: has the same schema as tHashOutput1.


View solution in original post

8 Replies
Anonymous
Not applicable

From your job screenshot, I see you use a tFlowToIterate to iterate each input row, that's why it override the output file and only has the last record. If you want to output all records in one file, change the job to like:
.....tMap1-->tHashOutput1
|onsubjobok
tHashInput1--main--tFileOutputJson

on tHashOutput1: make sure the 'Append' box is checked.
tHashInput1: has the same schema as tHashOutput1.


gadje1
Creator
Creator
Author

Super Shong, thanks a lot,

Exactly what i wanted to do. Now i would like to be able to structure my Json file like showed in my example and how to set the order of the "keys:values" ? Is there a way for doing it and how to do ?

Anonymous
Not applicable

Hi
If the input data has multiple rows, it is easy to generate the Json file like you showed. What do you meant 'set the order of the 'keys:values'?

Regards
Shong
gadje1
Creator
Creator
Author

Thanks for your reply Shong,

 

Here is my brut result :

[{"photo_10":"","departement":"29","numero":"29001","titre":"SARL","latitude":"47.8975424","nom":"LE BERRE BERNARD","video_1":"AD001_VID1.mp4","fictif":"false","logo":"AD001_LOGO.png","tel":"0298826709","id":"AD001","fax":"0298826171","email":"CONTACT@LEBERRE-BERNARD.FR","site_web":"www.leberre-bernard.fr","longitude":"47.8975424","photo_1":"AD001_IMG1.jpg","code_postal":"29000","photo_2":"AD001_IMG2.jpg","ville":"QUIMPER","photo_3":"AD001_IMG3.jpg","photo_4":"AD001_IMG4.jpg","photo_9":"AD001_IMG9.jpg","adresse_1":"30 av des sports","photo_5":"AD001_IMG5.jpg","photo_6":"AD001_IMG6.jpg","recherche":"+29000+LE+BERRE+BERNARD+AD001","photo_7":"AD001_IMG7.jpg","adresse_2":"","photo_8":"AD001_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29006","titre":"","latitude":"48.0004315","nom":"PRAT FERNAND","video_1":"AD006_VID1.mp4","fictif":"false","logo":"AD006_LOGO.png","tel":"0609385747","id":"AD006","fax":"0298595634","email":"PRATFERNAND@ORANGE.FR","site_web":"","longitude":"48.0004315","photo_1":"AD006_IMG1.jpg","code_postal":"29500","photo_2":"AD006_IMG2.jpg","ville":"ERGUE GABERIC","photo_3":"AD006_IMG3.jpg","photo_4":"AD006_IMG4.jpg","photo_9":"AD006_IMG9.jpg","adresse_1":"8 RUE AMPERE","photo_5":"AD006_IMG5.jpg","photo_6":"AD006_IMG6.jpg","recherche":"+29500+PRAT+FERNAND+AD006","photo_7":"AD006_IMG7.jpg","adresse_2":"ZA DE KEROURVOIS SUD","photo_8":"AD006_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29007","titre":"SARL","latitude":"47.7958180","nom":"CORNOU JEAN LUC","video_1":"AD007_VID1.mp4","fictif":"false","logo":"AD007_LOGO.png","tel":"0298715187","id":"AD007","fax":"0298715958","email":"CONTACT@MENUISERIE-CORNOU.COM","site_web":"www.menuiserie-cornou.com","longitude":"47.7958180","photo_1":"AD007_IMG1.jpg","code_postal":"29360","photo_2":"AD007_IMG2.jpg","ville":"CLOHARS CARNOET","photo_3":"AD007_IMG3.jpg","photo_4":"AD007_IMG4.jpg","photo_9":"AD007_IMG9.jpg","adresse_1":"","photo_5":"AD007_IMG5.jpg","photo_6":"AD007_IMG6.jpg","recherche":"+29360+CORNOU+JEAN+LUC+AD007","photo_7":"AD007_IMG7.jpg","adresse_2":"5 CHEMIN DES 2 FOURS","photo_8":"AD007_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29009","titre":"EURL","latitude":"48.0556598","nom":"LIJOUR PASCAL","video_1":"AD009_VID1.mp4","fictif":"false","logo":"AD009_LOGO.png","tel":"0298945274","id":"AD009","fax":"0298945118","email":"LIJOURPASCAL@WANADOO.FR","site_web":"","longitude":"48.0556598","photo_1":"AD009_IMG1.jpg","code_postal":"29510","photo_2":"AD009_IMG2.jpg","ville":"BRIEC","photo_3":"AD009_IMG3.jpg","photo_4":"AD009_IMG4.jpg","photo_9":"AD009_IMG9.jpg","adresse_1":"","photo_5":"AD009_IMG5.jpg","photo_6":"AD009_IMG6.jpg","recherche":"+29510+LIJOUR+PASCAL+AD009","photo_7":"AD009_IMG7.jpg","adresse_2":"MENEZ CROAS VAR","photo_8":"AD009_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29010","titre":"SARL","latitude":"48.4238171","nom":"HALL - GUEGAN","video_1":"AD010_VID1.mp4","fictif":"false","logo":"AD010_LOGO.png","tel":"0298896671","id":"AD010","fax":"0298896744","email":"SARLHALLGUEGAN@ORANGE.FR","site_web":"www.charpente-hall-guegan.com","longitude":"48.4238171","photo_1":"AD010_IMG1.jpg","code_postal":"29290","photo_2":"AD010_IMG2.jpg","ville":"ST RENAN","photo_3":"AD010_IMG3.jpg","photo_4":"AD010_IMG4.jpg","photo_9":"AD010_IMG9.jpg","adresse_1":"","photo_5":"AD010_IMG5.jpg","photo_6":"AD010_IMG6.jpg","recherche":"+29290+HALL+-+GUEGAN+AD010","photo_7":"AD010_IMG7.jpg","adresse_2":"ZA DE MESPAOL","photo_8":"AD010_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29012","titre":"EURL","latitude":"48.4295021","nom":"QUEMENEUR MENUISERIE","video_1":"AD012_VID1.mp4","fictif":"false","logo":"AD012_LOGO.png","tel":"0298075753","id":"AD012","fax":"0298076397","email":"QUEMENEUR.MENUISERIE@ORANGE.FR","site_web":"www.menuiserie-ossature-bois-charpente.fr","longitude":"48.4295021","photo_1":"AD012_IMG1.jpg","code_postal":"29820","photo_2":"AD012_IMG2.jpg","ville":"GUILERS","photo_3":"AD012_IMG3.jpg","photo_4":"AD012_IMG4.jpg","photo_9":"AD012_IMG9.jpg","adresse_1":"ZAC DE KEREBRAS","photo_5":"AD012_IMG5.jpg","photo_6":"AD012_IMG6.jpg","recherche":"+29820+QUEMENEUR+MENUISERIE+AD012","photo_7":"AD012_IMG7.jpg","adresse_2":"RUE JEAN FOIS CHAMPOLLION","photo_8":"AD012_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29013","titre":"EURL","latitude":"47.8354037","nom":"LE MIGNON ROGER","video_1":"AD013_VID1.mp4","fictif":"false","logo":"AD013_LOGO.png","tel":"0298064451","id":"AD013","fax":"0298064451","email":"ROGERLEMIGNON@ORANGE.FR","site_web":"","longitude":"47.8354037","photo_1":"AD013_IMG1.jpg","code_postal":"29340","photo_2":"AD013_IMG2.jpg","ville":"RIEC SUR BELON","photo_3":"AD013_IMG3.jpg","photo_4":"AD013_IMG4.jpg","photo_9":"AD013_IMG9.jpg","adresse_1":"20 RUE DES OISEAUX","photo_5":"AD013_IMG5.jpg","photo_6":"AD013_IMG6.jpg","recherche":"+29340+LE+MIGNON+ROGER+AD013","photo_7":"AD013_IMG7.jpg","adresse_2":"","photo_8":"AD013_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29017","titre":"SARL","latitude":"47.9357789","nom":"DILIGEART","video_1":"AD017_VID1.mp4","fictif":"false","logo":"AD017_LOGO.png","tel":"0298562192","id":"AD017","fax":"0298567150","email":"DILIGEART.PATRICE@WANADOO.FR","site_web":"www.menuiserie-diligeart-fouesnant.fr","longitude":"47.9357789","photo_1":"AD017_IMG1.jpg","code_postal":"29170","photo_2":"AD017_IMG2.jpg","ville":"SAINT EVARZEC","photo_3":"AD017_IMG3.jpg","photo_4":"AD017_IMG4.jpg","photo_9":"AD017_IMG9.jpg","adresse_1":"","photo_5":"AD017_IMG5.jpg","photo_6":"AD017_IMG6.jpg","recherche":"+29170+DILIGEART+AD017","photo_7":"AD017_IMG7.jpg","adresse_2":"261 ROUTE DE CONCARNEAU","photo_8":"AD017_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29019","titre":"SAS","latitude":"47.980201","nom":"BARRE","video_1":"AD019_VID1.mp4","fictif":"false","logo":"AD019_LOGO.png","tel":"0298545778","id":"AD019","fax":"0298545209","email":"CONTACT@BARRE-SARL.FR","site_web":"","longitude":"47.980201","photo_1":"AD019_IMG1.jpg","code_postal":"29700","photo_2":"AD019_IMG2.jpg","ville":"PLUGUFFAN","photo_3":"AD019_IMG3.jpg","photo_4":"AD019_IMG4.jpg","photo_9":"AD019_IMG9.jpg","adresse_1":"ZA DE TI LIPIG","photo_5":"AD019_IMG5.jpg","photo_6":"AD019_IMG6.jpg","recherche":"+29700+BARRE+AD019","photo_7":"AD019_IMG7.jpg","adresse_2":"IMPASSE DE KERBENHIR","photo_8":"AD019_IMG8.jpg","information":""},{"photo_10":"","departement":"29","numero":"29021","titre":"SARL","latitude":"48.5270279","nom":"DILASSER","video_1":"AD021_VID1.mp4","fictif":"false","logo":"AD021_LOGO.png","tel":"0298728589","id":"AD021","fax":"0298729008","email":"ODILASSER@DILASSER.COM","site_web":"www.ossature-bois-bretagne.com","longitude":"48.5270279","photo_1":"AD021_IMG1.jpg","code_postal":"29610","photo_2":"AD021_IMG2.jpg","ville":"PLOUIGNEAU","photo_3":"AD021_IMG3.jpg","photo_4":"AD021_IMG4.jpg","photo_9":"AD021_IMG9.jpg","adresse_1":"","photo_5":"AD021_IMG5.jpg","photo_6":"AD021_IMG6.jpg","recherche":"+29610+DILASSER+AD021","photo_7":"AD021_IMG7.jpg","adresse_2":"ZA de KERVANON","photo_8":"AD021_IMG8.jpg","information":""}]

The data is OK.

 

my result is like that except the structure, i did it manually for an easyest reading :

 

{
		"photo_10":"AD001_IMG10.jpg",
		"departement":"29",
		"numero":"29001",
		"titre":"SARL",
		"latitude":"47.8975424",
		"nom":"LE BERRE BERNARD",
		"video_1":"AD001_VID1.mp4",
		"fictif": false,
		"logo":"AD001_LOGO.png",
		"tel":"0298826709",
		"id":"AD001",
		"fax":"0298826171",
		"email":"CONTACT@LEBERRE-BERNARD.FR",
		"site_web":"www.leberre-bernard.fr",
		"longitude":"47.8975424",
		"photo_1":"AD001_IMG1.jpg",
		"code_postal":"29000",
		"photo_2":"AD001_IMG2.jpg",
		"ville":"QUIMPER",
		"photo_3":"AD001_IMG3.jpg",
		"photo_4":"AD001_IMG4.jpg",
		"photo_9":"AD001_IMG9.jpg",
		"adresse_1":"30 av des sports",
		"photo_5":"AD001_IMG5.jpg",
		"photo_6":"AD001_IMG6.jpg",
		"recherche":"+29000+LE+BERRE+BERNARD+AD001",
		"photo_7":"AD001_IMG7.jpg",
		"adresse_2":"",
		"photo_8":"AD001_IMG8.jpg",
		"information":""
	},

 

And this is what i should obtaining :

 

{
		"id": "AD001",
		"numero": 29001,
		"nom": "LE BERRE BERNARD",
		"adresse_1": "30 av des sports",
		"adresse_2": "",
		"code_postal": "29000",
		"departement": "29",
		"ville": "QUIMPER",
		"tel": "0298826709",
		"fax": "0298826171",
		"site_web": "www.leberre-bernard.fr",
		"email": "CONTACT@LEBERRE-BERNARD.FR",
		"titre": "",
		"information": "",
		"recherche": "+29000+LE+BERRE+BERNARD+AD001",
		"latitude": "47.8975424",
		"longitude": "-4.2692572",
		"fictif": false,
		"photo_1": "AD001_IMG1.jpg",
		"photo_2": "AD001_IMG2.jpg",
		"photo_3": "AD001_IMG3.jpg",
		"photo_4": "AD001_IMG4.jpg",
		"photo_5": "AD001_IMG5.jpg",
		"photo_6": "AD001_IMG6.jpg",
		"photo_7": "AD001_IMG7.jpg",
		"photo_8": "AD001_IMG8.jpg",
		"photo_9": "AD001_IMG9.jpg",
		"photo_10": "",
		"video_1": "AD001_VID1.mp4",
		"logo": "AD001_LOGO.png"
	},

I put all my values in good order in my tMap but it dosn't work.

And i dont know how structure the data like showed above with "tFileOutputJSON" component.

Anonymous
Not applicable

It is just a display issue or the order of element changes?
gadje1
Creator
Creator
Author

It's an elements order changes and structuring Json file (indentation, end of lines).

Anonymous
Not applicable

It sounds like a bug, the issue always occurs or it is random? Which version of studio are you using?
gadje1
Creator
Creator
Author

Hi Shong,
Sorry for my reply delay.
My Json file work despite all.
Thanks for your assist.
I change this topic in resolved.