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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tFileOutputJSON - How to change order of fields

Title says it mostly. To specify, my incoming rows are already arranged in their proper arrangement, but how come they are scrambled up once the JSON file was generated? (i.e. they are not in the order of the input rows).
Thanks in advance,
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
I tested and got the same issue, as alternative solution, you can use tWriteJsonFiled+tFileOutputDelimited to generate a json file, tWriteJsonFiled provides a visual GUI that allows you to configure the json structure more easy. eg:
...tWriteJsonField--main--tFileOutputDelimtied

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi 
Can you please show us an example to explain your problem? What is the result you are getting and what are you expected result?
Best regards
Shong
Anonymous
Not applicable
Author

Hello,
Here is a breakdown of the order:

tLogRow output to print values before creating JSON file:
+----------------+-----------+
| key            | value     |
+----------------+-----------+
| givenName      | BRIDGITTE |
| surname        | TIMPSON   |
| Sex            | Female    |
| Code           | Passport  |
| Code1          | P         |
| Code2          | <         |
| birthDate      | {30/2/99} |
| documentNumber | 308722518 |
| expirationDate | {1/1/16}  |
| format         | PASSPORT  |
| issuingCountry | GBR       |
| nationality    | GBR       |
+----------------+-----------+

JSON file structure:
{
  "MRZ Fields":
}
How come they are not in order? My Job simply has tJavaRow -- tLogRow -- tFileOutputJSON as components, with all columns being propagated to the next component.
Anonymous
Not applicable
Author

Hi
I tested and got the same issue, as alternative solution, you can use tWriteJsonFiled+tFileOutputDelimited to generate a json file, tWriteJsonFiled provides a visual GUI that allows you to configure the json structure more easy. eg:
...tWriteJsonField--main--tFileOutputDelimtied
Anonymous
Not applicable
Author

Atleast I know its not some bug that only I was experiencing.
So does this mean my job would now look like:
tJavaRow -- tLogRow -- tWriteJsonField -- tFileOutputDelimited
Anonymous
Not applicable
Author

Yes, let me know if you are able to generate the json file as expected. 
Anonymous
Not applicable
Author

Hi
I tested and got the same issue, as alternative solution, you can use tWriteJsonFiled+tFileOutputDelimited to generate a json file, tWriteJsonFiled provides a visual GUI that allows you to configure the json structure more easy. eg:
...tWriteJsonField--main--tFileOutputDelimtied

i tried this solution but the field names(column names) we have to add manually in tWriteJsonField.
I mean while entering the schema we have to add field names manually.
schemas are not auto generated nor copyable 0683p000009MPcz.png
if i have a file with 100 columns. just imagine how much work i have to do. this was the situation i am facing ri8 now. please tell me any other solution.
Anonymous
Not applicable
Author

Hi vhkhari 
To generate a Json file, we can use tFileOutputJson or tWriteJsonFields+tFileOutputDelimited, no other component can be used to write a Json file now. 
Best regards
Shong