Unanswered posts

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tFileInputJSON not escaping period (.) ?

#1 2011-06-30 16:27:43

jkrfs
Member
Registered: 2009-11-19
Posts: 204

[resolved] tFileInputJSON not escaping period (.) ?

I am pulling in data with JSON which normally works well, however my response has a period in its nested structure

Here is my test case.

JSON data:

{"errors":{"error.loaderFailure":["This is a row of error data", "Another row of erroneous data."]}}

The correct JSONpath query is this:
"$.errors.error\.loaderFailure[*]"

The backslash should be escaping the period, but in the tFileInputJSON it is not.

I know this should work because if I change the response to look like this:

{"errors":{"error_loaderFailure":["This is a row of error data", "Another row of erroneous data."]}}

And if I change the JSONPath query in tFileInputJSON to this:

"$.errors.error_loaderFailure[*]"

Then the json file is parsed correctly.

Anyone have any insight in this? I'm using TOS 4.2.2.

Offline

#2 2011-06-30 20:37:06

walkerca
Member
Company: Bekwam, Inc.
Registered: 2011-01-12
Posts: 253
Website

Re: [resolved] tFileInputJSON not escaping period (.) ?

Vexing problem...I tested this against your input with a '.' (parsed) and a string with '_' (rejected).

"$.errors[(\"error.loaderFailure\")][*]"


Visit bekwam.blogspot.com for Talend topics and tutorials.  Twitter @bekwaminc for updates.

Offline

#3 2011-06-30 20:54:37

jkrfs
Member
Registered: 2009-11-19
Posts: 204

Re: [resolved] tFileInputJSON not escaping period (.) ?

It worked! Thank you very much!

Offline

#4 2011-07-19 19:03:28

jkrfs
Member
Registered: 2009-11-19
Posts: 204

Re: [resolved] tFileInputJSON not escaping period (.) ?

I have another question:

Is there a way to group everything under one path? Using the above example with a modification:

{"errors":{"error.loaderFailure":["This is a row of error data", "Another row of erroneous data."]}{"error.anotherTypeOfFailure":["This is a third row of error data", "The last row of erroneous data."]}}

So, let's say I want to grab everything that is at $.errors.*

My output would be:
This is a row of error data
"Another row of erroneous data.
This is a third row of error data
The last row of erroneous data.
--
This way, I can avoid having errors of the tFileInputJson component not finding the specific path? Since the errors that come back through JSON can be a wide variety of kinds of errors I've had this error: "Can't find any data with JSONPath $.errors[("error.genevaLoaderFailure")][*]". But there were infact errors coming back, just different kinds.

If this is not possible, I suppose they'd have to implement a "Ignore Missing Path" option in the tFileInputJSON component.

Thanks

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tFileInputJSON not escaping period (.) ?

Board footer

Powered by FluxBB