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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

JSON array structure to get the information

Hi everybody,

 

I would like your opinion about this problem :

 

- I have these contents from a first job ( tOutputDelimited 😞

 

[{ ...
"labels": "[{\"idBoard\":\"57f269e64ebba4d3bfbc3fee\",\"color\":\"pink\",\"name\":\"Webapp\",\"uses\":53,\"id\":\"57f2721584e677fd36aa3646\"}]"
}]

 

- from a second job, I get these contents (tInputDelimited) :

...
},
		"labels": "\"label_name\": \"Webapp\","
	}

I would like to recover all the information of "labels" of the first job under JSON array and specially delete  the "\" in order to have like a JSON array :

 

["labels" : "blabla" ]

What do you suggest to me to do this thing : TMap ( to clean the file ) or TJava to set the structure of the file ? Tell me...

 

Thanks

 

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi everybody,

 

Finally I solved the problem :

 

- I used a tJavaRow and i added a code to get the label name, that is :

 

//get the label name under JSON array model
output_row.json = output_row.json.replaceAll("(\"\\w+\")\\s*:[^:]+:\\s*\\\\\\\"(\\w+)\\\\\\\",\"","$1: \\[\"$2\"\\]");

As a result I get :

"labels": ["Webapp"],

https://regex101.com/r/UVqVYo/1

 

View solution in original post

3 Replies
Anonymous
Not applicable
Author

Finally, I am working with "tJavaRow" componant.

Anonymous
Not applicable
Author

Hi,

Thanks for your feedback and sharing your solution with us. Could you please set this topic as resolved?

Best regards

Sabrina

Anonymous
Not applicable
Author

Hi everybody,

 

Finally I solved the problem :

 

- I used a tJavaRow and i added a code to get the label name, that is :

 

//get the label name under JSON array model
output_row.json = output_row.json.replaceAll("(\"\\w+\")\\s*:[^:]+:\\s*\\\\\\\"(\\w+)\\\\\\\",\"","$1: \\[\"$2\"\\]");

As a result I get :

"labels": ["Webapp"],

https://regex101.com/r/UVqVYo/1