json parsing issue

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sanoojk
Participant
Posts: 36
Joined: Wed Dec 19, 2007 3:54 am

json parsing issue

Post by sanoojk »

Hi,

I am trying to read a json file with a repeating element . I could read the data using the Heirarchical Data stage (1) and passing the repeating element as it is into the next Heirarchical Data stage (2) by defining it as a key. In Heirarchical Data stage (2) I have used the schema specific for the repeating element. Here I am getting the below error.:

CDIER0007E: An error occurred while reading input: language=JSON, cause=javax.xml.stream.XMLStreamException:

This is the sample json i/p data

Code: Select all

[
{"type": "session_completed", "data": {"assigned_time": 1462412060388, "tasks": [{"rank": 1462411092760, "task_id": 1102443}, {"task_id": 1102507, "rank": 1462411336661}], "description": "", "task_id": 50333, "hierarchy": [115, 258], "completed": true, "org_id": 307, "completed_time": 1462415765644, "last_modified": 1462415765644, "agent_id": 2711, "created_time": 1462412060399, "_id": 50333, "start_time": 1462415765644, "completed_unstarted": true}}
]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is your question?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

XMLStreamException is a catch due to an error somewhere else.

We need the complete stack trace (perhaps a review of the prior errors), and a detailed question. Thanks.

-T.J.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Just curious why is it giving an XML error while parsing JSON? It is expecting XML to parse? Shouldn't it give a JSON error, if there is any error at that point? Surely it's not converting JSON to XML behind the scenes...
Choose a job you love, and you will never have to work a day in your life. - Confucius
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

I don't know the "exact" guts of the Stage, but it uses the xml schema semantics for all of the layout work in the assembly, so while it isn't converting JSON strings to XML strings per se, one can fairly expect that is is using the the same "list" code as it walks thru your individual steps. This is a total guess, but I suspect that at some point in the assembly, the data no longer looks like json or xml...it's just organized into its various nodes. ...so the error itself shouldn't matter.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply