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: 
talend777
Contributor II
Contributor II

tjava parse json

Hi 

I have a file input in Talend studion  that contains below type of syntax and i need to extract userid, password from it

"{\"password\":\"aaa\",\"username\":\"aaab\"}"

any suggestion how to parse this json looking kind of field.

i tried tjsonextract but its not working correctly.

i am trying tjava and json.parse but that is also not working.

any suggestions/recommendations ?

 

Labels (3)
1 Solution

Accepted Solutions
Dave_Simo
Creator II
Creator II

Hello @talend777 

To parse this json, you would need to replace the \ with "" and then pass it to the tExtractJSONFields component.

Dave_Simo_0-1748101645847.png

tJavaRow Config

Dave_Simo_1-1748101759886.png

tExtractJSONFields Config

Dave_Simo_2-1748101797151.png

 

Best Regards

View solution in original post

4 Replies
Dave_Simo
Creator II
Creator II

Hello @talend777 

To parse this json, you would need to replace the \ with "" and then pass it to the tExtractJSONFields component.

Dave_Simo_0-1748101645847.png

tJavaRow Config

Dave_Simo_1-1748101759886.png

tExtractJSONFields Config

Dave_Simo_2-1748101797151.png

 

Best Regards

talend777
Contributor II
Contributor II
Author

Thank you @Dave_Simo 

may i know how does your schema looks like for tjsonExtract fields 

i tried like below and passed it as string and it removed the / but for some reason its not working for tjsonExtract 

String json = String.valueOf("{\"password\":\"bbbb\",\"username\":\"aaaa\"}");

 

globalMap.put("json", json );

System.out.println("json :" +globalMap.get("json"));

 

talend777_1-1748351566838.png

 

talend777_2-1748351597936.pngtalend777_3-1748351626668.png

talend777_4-1748351858066.png

 

 

Dave_Simo
Creator II
Creator II

hello @talend777 

 

Dave_Simo_0-1748355239984.png

 

talend777
Contributor II
Contributor II
Author

Thank you so much @Dave_Simo for your help , it is working

talend777_0-1748357621238.png