I create an XML dump file with JAXB, then i go through several transformations and arrive at a XML file that is in a format i desire. Now i want to convert this XML File that is properly escaped and encoded into a JSON file using JAXB.
I am NOT trying to marshall an object to JSON but the contents of a File.
This marshals my object to json:
JAXBContext jc = JAXBContext.newInstance(Employee.class);
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(employee, System.out);
How do i do this for a file that was created by JAXB and transformation, it is called employeeFormatC.xml
The reason it needs to be from file and not object is because i use various style xslt to format the original xml output. I don't see a reason to do that for the json, when i can just convert an already generated and formatted xml.