Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
aaronrums
Contributor II
Contributor II

Backslashes being inserted from tExtractJSONFields component

Hello! I am reading a JSON document which contains a "url" field, which has a value of a full url (of course).

When parsing this document with tExtractJSONFields, it is adding a backslash prior to every forward slash. See below for example.

Example value :

"https://blah.domain.com/files/orphan/area/123/16/DocName.doc",

Example output, when parsed with

tExtractJSONFields:

"https:\/\/blah.domain.com\/files\/orphan\/area\/123\/16\/DocName.doc"

I've seen similar posts, but with no solid resolution.

I don't want resort to doing a REPLACE(urlColumn, "\/", "/").

Labels (3)
6 Replies
Anonymous
Not applicable

I'm afraid I do not experience this and I use the tExtractJSONFields component a lot. However, I may not be using it like you are using it. Can you show me how you are using this and also show a sample of the JSON that is being parsed? A screenshot of your job, the tExtractJSONFields component and a sample of the JSON should be enough information here.

aaronrums
Contributor II
Contributor II
Author

Sure, thanks for the response. For what it's worth, I'm using a windows machine, which use backslashes for file paths.0695b00000bHH4qAAG.png0695b00000bHH4WAAW.png

aaronrums
Contributor II
Contributor II
Author

just found this post...it seems like it has to do with JSONPath escaping the forward slashes. But I'm not sure how/if there's a good fix for it in Talend. I'm curious if you see the same result if you set up a quick job with a URL in a JSON document.

 

Solved: Why does XML to JSON insert a backslash in front o... - Google Cloud Community

Anonymous
Not applicable

Hmmmm that is strange. I presume that the JSON is being returned by the tREST and the JSON you have added here is taken from what is returned by the tREST without having been modified? I just took your file and quickly knocked up a job to extract just the URL and got this....

 

https://sample.test.com/files/orphan/corpus/abd:efg:document:DOC8D106249881A06C/16/doc1.doc

https://sample.test.com/files/orphan/corpus/abd:efg:document:DOC8D106249881A06C/15/doc2.doc

 

No further editing. Can you test this? Just use a tFileInputRaw to bring your file data in (the JSON) and then use a tExtractJSONFields to extract the url? I used this as the loop jsonpath query...

 

"$.data.versions[*]"

 

...and just returned the "url" with this ....

 

"url"

 

I then added a tLogRow afterwards. You should see the same as me. If not, this could be a bug.

aaronrums
Contributor II
Contributor II
Author

got the answer. Seems like this is happening only when I use ".url" as the query for that field (note the period). Using simply "url" solved the problem! Incidentally, this also removes the square brackets and quotes surrounding the return values as well (previously I was getting ["value"]). Thank you!

michea
Contributor
Contributor

In Truck Simulator Ultimate, unexpected data changes—like backslashes appearing in JSON fields—can disrupt information flow, just as routing errors affect delivery efficiency. In this case, check component configurations or encoding settings to prevent unwanted characters, much like double-checking route settings in-game to ensure smooth and accurate transport operations. Click Here