Tuesday, April 28, 2015

JSON & XML Online Conversion tool

http://jsonxmlutil.appspot.com/
This tutorial is for converting JSON to XML or XML to JSON. The conversion happens using APIGEE tool, which is used to develop APIs. For the conversion of JSON/XML we use the target endpoint's that are developed on APIGEE tool. We create an API for the conversion which will have two resources inorder to handle JSONtoXML and XMLtoJSON requests.

Step1:Create a resource jsontoxml or any name..


Step2: In develope section , you can arrange all the policies to be applied on the requests. The request gets route on the basis of matching pattern Ex: ../convert/jsontoxml,.../convert/xmltojson (For this you should have good understanding on APIGEE )


Step3: Deploy to environment available


Step4: Go to trace section and Start the Trace Session and hit the url's, you find the live traffic logging.


Finally


How does the conversion happen

APIGEE tool has the ability to do service chaining, sampling data, make XML/JSON conversions, extract variables from request or response e.t.c
APIGEE record the request sent by user into request variable, we now form a list of policies in a sequence to be executed.
Ex: for xml to json conversion, in the response flow


1) Create an assign message policy and assign all the xml request that is sent into an variable response.
2)Send this response xml to an XML to JSON policy using the request as source & assign it to an output variable.
3)Finally assign the json response in an Assign-Message-Policy which can be consumed by any one who ever sends the request.


Source code has been bundled, any one needs this proxy can download it from the url and import in their APIGEE account. Download Here

No comments:

Post a Comment