You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vinny <xa...@gmail.com> on 2015/01/13 22:01:55 UTC

Re: camel xmljson add @ signs to the json output. how to remove the @ signs

Do the component developers follow this list? I'd love to see a switch as
well. Issue tracker for components ?

On Wed Nov 26 2014 at 1:44:01 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Did you get in contact with the xmjson team about the issue and if
> they are willing to add a flag to turn this on/off etc?
>
> On Tue, Nov 18, 2014 at 9:18 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> > Hi
> >
> > Ah great to know it was hardcoded. I would suggest to ask them to add
> > an option so you can turn that off. As there are use cases where you
> > only need a one way transformation.
> >
> > They could also consider different strategies how to control this
> > mapping. So there is a default strategy that does as today. And then
> > people can switch to different ones, such as one that simply dont
> > include those signs. And another that allow end users to provide their
> > own mapping code to have 100% control how they want to do that.
> >
> > An alternative is that we introduce an option in the Camel component
> > but then it would need to process the output message and remove those
> > @ signs. But its IMHO better to improve this in the xmljson library
> > itself.
> >
> > On Mon, Nov 17, 2014 at 9:10 PM, salemi <sa...@avaya.com> wrote:
> >> Hi Clause,
> >>
> >> I looked at their json-lib code and based on what I read they need to
> have
> >> the @ sign for the attributes and # for the text elements.
> >> They need those "annotations" to be able to covert a json properly back
> to
> >> xml. The @ and # signs are hard coded in their code.
> >>
> >> Do you think I should asked to change the code?
> >>
> >> Ali
> >>
> >>
> >>
> >>
> >>
> >> -----
> >> Alireza Salemi
> >> --
> >> View this message in context: http://camel.465427.n5.nabble.
> com/camel-xmljson-add-signs-to-the-json-output-how-to-remove-the-signs-
> tp5759013p5759220.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8: http://fabric8.io/
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8 <http://hawt.io/fabric8>: http://fabric8.io/
>

Re: camel xmljson add @ signs to the json output. how to remove the @ signs

Posted by Raul Kripalani <ra...@evosent.com>.
Hey guys,

It's me who developed this component, but in Camel we can only go as far as
the Jsonlib library goes. Jsonlib prefixes XML attributes with '@' when
converting them into JSON properties [1]. I think this is correct: without
some kind of differentiation, you wouldn't be able to cycle back from JSON
to XML accurately.

As Claus said, we could add a feature in our camel-xmljson data format to
remove the @ signs, but that would be post-processing and not very
performant.

Please feel free to submit a pull request + JIRA if you'd like this
functionality. The issue tracker is [2]. Make sure to select
'camel-xmljson' as the Component when you file the ticket.

[1]
http://json-lib.sourceforge.net/xref/net/sf/json/xml/XMLSerializer.html#1081
[2] https://issues.apache.org/jira/browse/CAMEL

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Tue, Jan 13, 2015 at 9:01 PM, Vinny <xa...@gmail.com> wrote:

> Do the component developers follow this list? I'd love to see a switch as
> well. Issue tracker for components ?
>
> On Wed Nov 26 2014 at 1:44:01 AM Claus Ibsen <cl...@gmail.com>
> wrote:
>
> > Hi
> >
> > Did you get in contact with the xmjson team about the issue and if
> > they are willing to add a flag to turn this on/off etc?
> >
> > On Tue, Nov 18, 2014 at 9:18 AM, Claus Ibsen <cl...@gmail.com>
> > wrote:
> > > Hi
> > >
> > > Ah great to know it was hardcoded. I would suggest to ask them to add
> > > an option so you can turn that off. As there are use cases where you
> > > only need a one way transformation.
> > >
> > > They could also consider different strategies how to control this
> > > mapping. So there is a default strategy that does as today. And then
> > > people can switch to different ones, such as one that simply dont
> > > include those signs. And another that allow end users to provide their
> > > own mapping code to have 100% control how they want to do that.
> > >
> > > An alternative is that we introduce an option in the Camel component
> > > but then it would need to process the output message and remove those
> > > @ signs. But its IMHO better to improve this in the xmljson library
> > > itself.
> > >
> > > On Mon, Nov 17, 2014 at 9:10 PM, salemi <sa...@avaya.com> wrote:
> > >> Hi Clause,
> > >>
> > >> I looked at their json-lib code and based on what I read they need to
> > have
> > >> the @ sign for the attributes and # for the text elements.
> > >> They need those "annotations" to be able to covert a json properly
> back
> > to
> > >> xml. The @ and # signs are hard coded in their code.
> > >>
> > >> Do you think I should asked to change the code?
> > >>
> > >> Ali
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> -----
> > >> Alireza Salemi
> > >> --
> > >> View this message in context: http://camel.465427.n5.nabble.
> > com/camel-xmljson-add-signs-to-the-json-output-how-to-remove-the-signs-
> > tp5759013p5759220.html
> > >> Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > Email: cibsen@redhat.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> > > hawtio: http://hawt.io/
> > > fabric8: http://fabric8.io/
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8 <http://hawt.io/fabric8>: http://fabric8.io/
> >
>