Background:
- I'm calling web APIs that are in JSON format and passing them through a data orchestration tool that needs them in XML format.
- Orchestration tool allows custom Java procedures.
Problem:
- JSON can contain elements that when converted to XML cause issues. For example twitter handles @john: somevalue is fine for a key in JSON but when converted to XML <@john>somevalue causes the orchestration tool to throw errors.
- I'm hitting a wide variety of web APIs that change often. I need to be able to convert arbitrary JSON to XML with little to no maintenance.
Research so far:
- I've found several ways to convert JSON to XML in Java but many of them are for fixed input structures.
- This StackOverflow post seems like what I want but I'm having issues getting it to work and tracking down all of the JARs required.
- I've seen some libraries will do some basic character escapes for &, <, >, ' and ". Is there one that is more robust?