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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

RESTRequest JSON to CSV format - repeating arrays

Hello together!

 

At the moment I have no other idea.. since hours no real success (ok - I am not an expert..), maybe someone can help me 🙂

 

I am trying to solve the following scenario:

  1. REST Webservice is receiving the following JSON content:
    {
    	"JsonLanguage": "en",
    	"RestService": "CreateFile",
    
    	"App1": {
    		"Meta1": "mainapp1",
    		"Meta2": "c",
    		"Meta3": "abcdefghijklmnopqrstuvwxyz1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234"
    	},
    	"App1Sub1": [
    		{
    		"Meta1Sub1": "subapp1",
    		"Meta2Sub1": "e",
    		},
    		{
    		"Meta1Sub1": "subapp1a",
    		"Meta2Sub1": "g",
    		},
    		{
    		"Meta1Sub1": "subapp1b",
    		"Meta2Sub1": "d",
    		}
    		],
    	"App1Sub2": [
    	{
    		"Meta1Sub2": "subapp2",
    		"Meta2Sub2": "test 2",
    	},
    	{	
    		"Meta1Sub2": "subapp2a",
    		"Meta2Sub2": "test 1",
    	}
    	],
    }
  2. Result should be a csv file with the following content:
    App1|mainapp1|c|abcdefghijklmnopqrstuvwxyz1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
    App1Sub1|subapp1|e
    App1Sub1|subapp1a|g
    App1Sub1|subapp1b|d
    App1Sub2|subapp2|test 2
    App1Sub2|subapp2a|test 1

    My problem is - I don't know how to create the csv file.

     

    I tried different scenarios:

    - using more than one tExtractJSON, no success

    - trying to extract the data with tXMLMap and tMAP, created small expressions to get each line beginning with the JSON field name "App1|" + row1.Meta1... but it is not working with arrays.

    - the idea to save the JSON values in a database and after that.. extracting as csv

    - the idea to save the JSON values in a XML file -> after that converting to csv

     

    The Point is... it would be ok if I change the JSON format, if the format is not good to create such a csv file. But the csv file.. cannot be changed.

     

    Thank u so much – and best regards

    Vera

Labels (6)
0 Replies