You are not logged in.
Unanswered posts
|
nestoru said:
Hi Talend team,
I believe I should open a bug right away but just in case let me post here first. I would appreciate any feedback on this one which just add more to other issues like the one I posted before: http://jira.talendforge.org/browse/TDI-19350
The issue is related to the way tFileInputJSON component handles mappings. It relies on building arrays per each field and then later associating them by index. That approach is wrong considering the arrays are built based on jsonpath expressions.
The component should be changed to use a parser API (DOM or stream based).
Here is a simple JSON example:
<code>
[
{
"name": "Gary"
},
{
"name": "Ron",
"state": "Texas"
},
{
"state": "Florida"
}
]
</code>
If you use the below expressions:
<code>
"$.[*].state"
"$.[*].name"
</code>
You do not get any errors but yet the results are wrong:
<blockquote>
Starting job json2 at 16:30 12/06/2012.
[statistics] connecting to socket on port 3849
[statistics] connected
Texas|Gary
Florida|Ron
[statistics] disconnected
Job json2 ended at 16:30 12/06/2012. [exit code=0]
</blockquote>
The only way to do this right relying on just json path is too cumbersome as one would need to build complicated expressions like just show the name where there is a state and the state where there is a name (in this example simple enough but consider what will happen with several more fields):
<code>
"$.[?(@.state)].name"
"$.[?(@.name)].state"
</code>
which results correctly in:
<blockquote>
Texas|Ron
</blockquote>
And yet it is far from ideal. The below result should be the one everybody will be looking for:
<blockquote>
null|Gary
Texas|Ron
Florida|null
</blockquote>
Thanks!
-Nestor
Offline