There is a following task / problem. From the server I receive the answer in the form of JSON'a. Using Java, you need to translate this JSON into a string containing valid XML .
Initially used org.Json . He can also parse json from string, and parse JSON to XML. Everything is good, but this library converts large / long numbers into an exponential (scientific) form, which I DO NOT need in the final XML string. How to display numbers in a normal form using org.json I did not understand. Next tried Gson . It parses JSON without any exponents (it even has a corresponding setting) , but I didn’t understand how to convert gson to XML. = _ =
Surely someone has already solved a similar problem? Tell me, please, the recipe for translating JSON to XML in Java, keeping the numbers in a normal form.
And yes, from the Json server does not contain any exhibitors, everything is in a normal form.
PS It would be ideal if the specified answer-solution normalized and those numbers that come from the server in scientific form (well, what if they do come?) , But this is optional and not necessary :)
JSON->Gson->объект(набор классов)->JAXB->XMLvariant not an option? - ChubatiyJAXB? Of course. The main thing here is to make a set of classes correctly, where, in fact, JSON will firstJSONand thenXML- Chubatiy