ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JSON Array parser error.

Post new topic  Reply to topic
 JSON Array parser error. « View previous topic :: View next topic » 
Author Message
Android 23
PostPosted: Wed Jun 14, 2017 8:59 pm    Post subject: JSON Array parser error. Reply with quote

Apprentice

Joined: 27 Mar 2017
Posts: 38

Quote:
<Details>

<HCRTable>
<HCRTable1>T15C</HCRTable1>
</HCRTable>
<HCRTable>
<HCRTable2>IFSR</HCRTable2>
</HCRTable>
</Details>


This is the input i received and need to parse it into JSON format using JSON Array in it.

Code:

      CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON';
      CREATE FIELD OutputRoot.JSON.Data.Details.HCRTable IDENTITY (JSON.Array) HCRTable;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[1].HCRTable1=InputRoot.XMLNSC.Details.HCRTable.HCRTable1;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[2].HCRTable2=InputRoot.XMLNSC.Details.HCRTable.HCRTable2;


Result i got:

Quote:
{
"Details": {
"HCRTable": [
{
"HCRTable1": "T15C"
},
{}
]
}
}


Desired Output:
Quote:

{
"Details": {
"HCRTable": [
{ "HCRTable1": "T15C" },
{ "HCRTable2": "IFSR" }
]
}
}


Please help me if i did mistake in my code.

Thanks in Advance.

Regards,
Android23
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 15, 2017 1:28 am    Post subject: Re: JSON Array parser error. Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Android 23 wrote:
Code:
<Details>

 <HCRTable>
         <HCRTable1>T15C</HCRTable1>
 </HCRTable>
 <HCRTable>
         <HCRTable2>IFSR</HCRTable2>
 </HCRTable>
</Details>


This is the input i received and need to parse it into JSON format using JSON Array in it.

Code:

      CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON';
      CREATE FIELD OutputRoot.JSON.Data.Details.HCRTable IDENTITY (JSON.Array) HCRTable;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[1].HCRTable1=InputRoot.XMLNSC.Details.HCRTable.HCRTable1;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[2].HCRTable2=InputRoot.XMLNSC.Details.HCRTable.HCRTable2;


Please help me if i did mistake in my code.

Thanks in Advance.

Regards,
Android23
Your problem is your code. It should look like this:
Code:

      CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON';
      CREATE FIELD OutputRoot.JSON.Data.Details.HCRTable IDENTITY (JSON.Array) HCRTable;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[1].HCRTable1=InputRoot.XMLNSC.Details.HCRTable[1].HCRTable1;
      SET OutputRoot.JSON.Data.Details.HCRTable.Item[2].HCRTable2=InputRoot.XMLNSC.Details.HCRTable[2].HCRTable2;

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JSON Array parser error.
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.