Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

XML to JSON Transformation

Sample use case

Convert an XML-formatted response to JSON.


This sample uses this policy:

  • alt text XML to JSON: to transform the response from XML to JSON format.


The sample API proxy calls a backend service that returns data in XML format by default. We use the XML to JSON policy on the response flow to transform the response to JSON.


The information returned by the backend service is in XML format by default:

    <city>San Jose</city>

After processing by the XML to JSON policy, the JSON data returned by the API call is:

{"root":{"city":"San Jose","firstName":"John","lastName":"Doe","state":"CA"}}

Set up, deploy, invoke

See the main project README file for information about setting up, deploying, and invoking sample proxies.

To deploy, run $ sh

To test, run $ sh


This screen shot from the Apigee Edge trace tool shows the placement of the policies used in this sample.

alt text

More information

Policy used in this sample

Related policies

Ask the community

alt text

Copyright © 2016 Apigee Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.