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 DataPower » How to Convert JSONX to JSON?

Post new topic  Reply to topic
 How to Convert JSONX to JSON? « View previous topic :: View next topic » 
Author Message
arunkumar1989
PostPosted: Wed Apr 09, 2014 3:28 am    Post subject: How to Convert JSONX to JSON? Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Hi All,


This is my JSONX Message
-------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<json:object name="person"
xsi:schemaLocation="http://www.datapower.com/schemas/json jsonx.xsd"
xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<json:object name="details">
<json:string name="city">Cleveland</json:string>
<json:string name="state">OH</json:string>
<json:string name="street">3661 Lincoln Avenue</json:string>
<json:number name="zipcode">44111</json:number>
</json:object>
<json:object name="name">
<json:string name="firstname">Sarah</json:string>
<json:string name="lastname">Chan</json:string>
<json:string name="title">Mrs</json:string>
</json:object>
</json:object>


How to Convert this to JSON?
_________________
Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
Back to top
View user's profile Send private message Send e-mail
mqsiuser
PostPosted: Wed Apr 09, 2014 3:39 am    Post subject: Re: How to Convert JSONX to JSON? Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

This is (just) xml

Answer:

Code:
CALL CopyMessageHeaders();
SET OutputRoot.JSON = InputRoot.XMLNSC;


On the input node configure XMLNSC

Minor correction may (have to be) apply(/applied)
_________________
Just use REFERENCEs


Last edited by mqsiuser on Wed Apr 09, 2014 3:40 am; edited 1 time in total
Back to top
View user's profile Send private message
sumit
PostPosted: Wed Apr 09, 2014 3:39 am    Post subject: Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

As far as I know, DataPower does that for you.
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
sumit
PostPosted: Wed Apr 09, 2014 4:02 am    Post subject: Re: How to Convert JSONX to JSON? Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

mqsiuser wrote:
This is (just) xml

Answer:

Code:
CALL CopyMessageHeaders();
SET OutputRoot.JSON = InputRoot.XMLNSC;

I suspect this kind of approach will cause problem when input XML has repeating tags, which requires 'Array of objects' representation in out going JSON message.
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
mqsiuser
PostPosted: Wed Apr 09, 2014 4:12 am    Post subject: Re: How to Convert JSONX to JSON? Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

My post is a total over-simplification, yes

You'll likely have to write some (custom) (transformation) code
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
arunkumar1989
PostPosted: Wed Apr 09, 2014 5:33 am    Post subject: Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Sorry to all, it can be easily done in Message Broker, but i need to do this in data power, so i need xslt , Please anybody
_________________
Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Apr 09, 2014 5:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Moved to DataPower section
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Apr 10, 2014 3:03 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

arunkumar1989 wrote:
Sorry to all, it can be easily done in Message Broker, but i need to do this in data power, so i need xslt , Please anybody


Have you read what the InfoCenter says here?
Back to top
View user's profile Send private message
arunkumar1989
PostPosted: Mon Apr 14, 2014 11:52 pm    Post subject: Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Got the Solution...!!!


In DataPower store location they have file called jsonxtojson.xsl


store:///jsonxtojson.xsl

We do not want to write XSLT for this conversion.


Thanks to all for your replies.
_________________
Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
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 DataPower » How to Convert JSONX to JSON?
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.