Aha! So you are using the <routes/> XML approach to load your routes.

You can define data formats in two places: either (a) inside your Camel
Context, which, if you are using exactly this approach [1], is being
configured programmatically, or (b) inline inside your marshal / unmarshal
XML element.

I would suggest you try (b):

<unmarshal>
    <xmljson... />
</unmarshal>

[1] http://camel.apache.org/loading-routes-from-xml-files.html

Regards,
Raúl.
On 1 Sep 2015 23:55, "anish.somadevan" <[email protected]> wrote:

> I currently have this as the first line in my XML.
>
> <routes xmlns="http://camel.apache.org/schema/spring";>
> And then i have defined the camelContext tags,
> <camelContext>
> <dataFormats>
>     <xmljson id="xmljson"/>
>     <xmljson id="xmljsonWithOptions" forceTopLevelObject="true"
> trimSpaces="true" rootName="newRoot" skipNamespaces="true"
>              removeNamespacePrefixes="true" expandableProperties="d e"/>
> </dataFormats>
> </camelContext>
> </routes>
>
> When i tried to give camelContext as the first line, I get this error
>
> unexpected element (uri:"http://camel.apache.org/schema/spring";,
> local:"camelContext"). Expected elements are
> <{http://camel.apache.org/schema/spring}aggregate>,<{
> http://camel.apache.org/schema/spring}aop>,<{
> http://camel.apache.org/schema/spring}avro>,<{
> http://camel.apache.org/schema/spring}batchResequencerConfig>,<{
> http://camel.apache.org/schema/spring}bean>,<{
> http://camel.apache.org/schema/spring}beanio>,<{
> http://camel.apache.org/schema/spring}bindy>,<{
> http://camel.apache.org/schema/spring}castor>,<{
> http://camel.apache.org/schema/spring}choice>,<{
> http://camel.apache.org/schema/spring}constant>,<{
> http://camel.apache.org/schema/spring}contextScan>,<{
> http://camel.apache.org/schema/spring}convertBodyTo>,<{
> http://camel.apache.org/schema/spring}crypto>,<{
> http://camel.apache.org/schema/spring}csv>,<{
> http://camel.apache.org/schema/spring}customDataFormat>,<{
> http://camel.apache.org/schema/spring}customLoadBalancer>,<{
> http://camel.apache.org/schema/spring}dataFormats>,<{
> http://camel.apache.org/schema/spring}delay>,<{
> http://camel.apache.org/schema/spring}description>,<{
> http://camel.apache.org/schema/spring}doCatch>,<{
> http://camel.apache.org/schema/spring}doFinally>,<{
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JSON-to-XML-Conversion-tp5771032p5771137.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to