|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problem Convertiong XMLNSC to JSON |
« View previous topic :: View next topic » |
Author |
Message
|
naio |
Posted: Wed Feb 13, 2013 1:11 pm Post subject: Problem Convertiong XMLNSC to JSON |
|
|
Voyager
Joined: 08 Nov 2012 Posts: 82
|
Hi To all,
I am facing the task to create a JSON message based on an XML.
I have made the XML with a Compute Node, and the Result is the Following:
Code: |
<XML2JSON>
<traces>
<id>0</id>
<type>COMPOUND</type>
<namespace>CL.BECH.services.{1714396}</namespace>
<values>
<EG_WF>
<VALUE>0</VALUE>
</EG_WF>
</values>
<createdAt>1360331150000</createdAt>
<consolidated>false</consolidated>
<jsonValue></jsonValue>
<defaultAgentId>EG_WF</defaultAgentId>
<properties>
<EG_WF>
<components>
<componentName>ENTRY.POINT.TransactionStart</componentName>
<start>2.4782E+4</start>
<ellapsed>7</ellapsed>
</components>
<components>
<componentName>ENTRY.POINT.TransactionStart</componentName>
<start>2.4782E+4</start>
<ellapsed>7</ellapsed>
</components>
</EG_WF>
</properties>
</traces>
<timestamp>3.8128653E+4</timestamp>
</XML2JSON> |
And I want the message that is between the Root Tag parsed to JSON, the result of:
SET OutputRoot.JSON.Data = InputBody.XML2JSON;
is the Following:
Code: |
{
"traces":{
"id":"0",
"type":"COMPOUND",
"namespace":"CL.BECH.services.{1714396}",
"values":{
"EG_WF":{
"VALUE":"0"
}
},
"createdAt":"1360331150000",
"consolidated":"false",
"jsonValue":null,
"defaultAgentId":"EG_WF",
"properties":{
"EG_WF":{
"components":{
"componentName":"ENTRY.POINT.TransactionStart",
"start":2.4782E+4,
"ellapsed":7
},
"components":{
"componentName":"ENTRY.POINT.TransactionStart",
"start":2.4782E+4,
"ellapsed":7
}
}
}
},
"timestamp":1.710246E+3
} |
The thing is that 'traces' and 'components' are ARRAYS so I expect the result to be like:
"traces":[....]
and
Code: |
"components":[
{
"componentName":"...",
"start":1360331144638,
"ellapsed":3
},
{
"componentName":"...",
"start":1360331144673,
"ellapsed":2472
},
] |
So I tried with:
SET OutputRoot.JSON.Data.traces TYPE = JSON.Array;
But that action eliminate the field name:
Code: |
{
"traces":[
"0",
"COMPOUND",
"CL.BECH.services.{1714396}",
{
"EG_WF":{
"VALUE":"0"
}
},
"1360331150000",
"false",
null,
"EG_WF",
{
"EG_WF":{
"components":{
"componentName":"ENTRY.POINT.TransactionStart",
"start":2.4782E+4,
"ellapsed":7
},
"components":{
"componentName":"ENTRY.POINT.TransactionStart",
"start":2.4782E+4,
"ellapsed":7
}
}
},
{
}
],
"timestamp":2.9214122E+4
}
|
The array is created, but the some field names are erased.
Any Help will be thanked!
regads _________________ "God is in his heaven all's right with the world" |
|
Back to top |
|
 |
kimbert |
Posted: Wed Feb 13, 2013 1:31 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That is unreadable. If you want help, please edit your post and add code tags. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Feb 14, 2013 9:43 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
edited for tags...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|