Siddu
Siddu

Reputation: 91

how to form payload for the following JSON in wso2 esb

Following is the JSON trying add in payload factory mediator(wso2 esb 4.8.1):

{
   "root":"<abc>
      <ab>
        <id>361</id>
        <name>What’s your number</name>
        <age>number</age>
      </ab>
    </abc>"
} 

When i add this in payload factory mediator succesfully added but when re-open again xml tags are not there only JSON payload is there like below:

{"root":""}

I need to know how to add these kind of payloads in WSO2 ESB as a payload/request for any one of the servcie.

Upvotes: 0

Views: 525

Answers (1)

alber arce
alber arce

Reputation: 371

The problem is that you have xml structure inside json. Try this payloadFactory:

<payloadFactory media-type="json">
<format>
{"root":
    {"abc":
        {"ab":
            {"id":"362","name":"What’s your number","age":"number"}
        }
    }   
}       
</format>
<args/>
</payloadFactory>

You can find more information here: https://docs.wso2.com/display/ESB481/JSON+Support

Upvotes: 1

Related Questions