Applying JSON to XML or XML to JSON policies
As you have seen throughout this chapter, there are two data formats that we have been focusing on – XML and JSON. They are the most prominent in today's API landscape. We have demonstrated the use of the map policy and how it can provide the need for custom transformations from one format to another. There may be times, however, when you just need to convert your JSON to an XML representation, or your XML to some standard JSON representation. Perhaps you are consuming JSON and want to log the payload, but your logging system requires XML, or vice versa. Or perhaps you have some XSLT that processes XML data, but the request is in JSON format. Whatever the case might be, there may be instances where you just need to transform XML to JSON or JSON to XML. For this purpose, API Connect provides two built-in policies, JSON to XML and XML to JSON. As you may have guessed, one transforms your JSON to an XML representation, and one transforms...