You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2012-06-12 23:41:39

nestoru
Member
57 posts

nestoru said:

tFileInputJSON does not work when there are null json values

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

#2 2012-06-13 07:40:14

pedro
Member
3682 posts

pedro said:

Re: tFileInputJSON does not work when there are null json values

Hi Nestor

I have reproduced this issue. Please report it on BugTracker.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-06-13 13:42:13

nestoru
Member
57 posts

nestoru said:

Re: tFileInputJSON does not work when there are null json values

Hi Pedro,

Ticket has been creted http://jira.talendforge.org/browse/TDI-21501

Thanks!
-Nestor

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy