XML to JSON Transformation
Sample use case
Convert an XML-formatted response to JSON.
This sample uses this policy:
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:
<root> <city>San Jose</city> <firstName>John</firstName> <lastName>Doe</lastName> <state>CA</state> </root>
After processing by the XML to JSON policy, the JSON data returned by the API call is:
Set up, deploy, invoke
See the main project README file for information about setting up, deploying, and invoking sample proxies.
To deploy, run
$ sh deploy.sh
To test, run
$ sh invoke.sh
This screen shot from the Apigee Edge trace tool shows the placement of the policies used in this sample.
Policy used in this sample
Ask the community
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.