DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
boxtoby



Group memberships:
Premium Members

Joined: 13 Mar 2006
Posts: 135
Location: UK
Points: 1450

Post Posted: Sun Apr 14, 2019 8:30 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hello,

I wonder if anyone can shed any light on this JSON parsing problem.

The following file structure is handled fine by the Hierarchical stage:

Code:
[
    {
        "reach": "national",
        "profile_id": "5y2",
        "First_name": "Bob",
        "last_name": "Xyz",
        "address": {
            "zip": "ABC 123",
            "country": "United Kingdom",
            "city": "Windsor",
            "state": "Berks",
            "state_code": "BK"
        }
    }
]

This example is NOT handled:

[
    {
        "profile_id": "567",
        "First_name": "Bob",
        "last_name": "Xyz",
        "address": {
            "zip": "ABC 123",
            "country": "United Kingdom",
            "city": "Windsor",
            "state": "Berks",
            "state_code": "BK"
        },
       "deciles": [
        {
            "decile_1": 4.0,
            "decile_2": 4.0,
            "decile_3": 6.0,
            "decile_4": 1.0
        }
        ]
    }
]

It seems that the introduction of the structure { [ ] } is causing me, at least, some problems.

The schema library import actually works fine for both examples, the problem comes with mapping the columns.

The name and address columns map fine but, although the decile columns are displayed, they are not available for mapping.

The imported structure looks like this:

Code:
JSON_Parser_Step
    ns0:root
        root_anon_choice_0
            e2res:@@choiceDescriminator
            nullValue
                objectValue
                    address
                    ...
                    ...
                first_name
                ...
                ...
                deciles
                    deciles_anon_choice_0
                        e2res:@@choiceDescriminator
                        nullValue
                            objectValue
                                decile_1
                                .....
                                .....

I would be very grateful if some could shed any light on this matter.

I should also add that I have no control over the JSON structure, that is decided elsewhere.

Cheers,
Bob

_________________
Bob Oxtoby
boxtoby



Group memberships:
Premium Members

Joined: 13 Mar 2006
Posts: 135
Location: UK
Points: 1450

Post Posted: Sun Apr 14, 2019 8:55 pm Reply with quote    Back to top    

I have discovered a little more. When I use the "Click to Select > More" method of mapping, attempting to map decile_1 produces the following error message:

CDIUI2820E The mapping is not applicable due to an invalid type conversion or difference in the source and target list dimensions. The decile_1 is seen as a type string by the import is being mapped in to a varchar so there shouldn't be a problem.

Cheers,
Bob.

_________________
Bob Oxtoby
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42923
Location: Denver, CO
Points: 221366

Post Posted: Sun Apr 14, 2019 10:32 pm Reply with quote    Back to top    

<added some code tags for you>

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
eostic

Premium Poster



Group memberships:
Premium Members

Joined: 17 Oct 2005
Posts: 3813

Points: 30674

Post Posted: Tue Apr 16, 2019 5:37 am Reply with quote    Back to top    

The biggest key to parsing structures in the hierarchical stage is in the vwry first thing you need to do when you arrive at the mapping page.....before you do ANYTHING else, first map "the lowest lev ...

_________________
Ernie Ostic

blogit!
Open IGC is Here!
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours