0

I have a JSON which is converted from xml. (XML to JSON) But the converted JSON file has some datatype issue, which is not matched with the expected JSON schema For ex: expected is accountId: "123" (in Json schema type is mentioned as String) But actual result is accountId: 123 (it received as a number)

While converting XML to JSON (StAXON parse) makes like this, yes offcourse I didn't feed any datatype related parameters while converting XML to JSON.

From here I have two questions:

  1. Is there any way to resolve my issue while xml to json convertion itself
  2. Or else from my Json, I need to validate with Json schema and change the datatype accordingly.

Guide me to do this in better way. Feel free to edit the question as my text is not understandable/misleading.

Note: I am using Spring Integration!!!

Maharajan
  • 11
  • 5
  • https://stackoverflow.com/questions/1823264/quickest-way-to-convert-xml-to-json-in-java try this once – Amol Gharpure Oct 14 '19 at 11:38
  • Thanks for your reply, but I wanted to know any way to feed the Json schema or xml schema along with the xml to change the datatype of Json. Basically I am struck up with xml to json convertion, the universal xml to json parsing doesnt care about the datatype of the element. But I wanted to know any way is there we can feed the xsd schema or json schema along with the xml while parsing xmlToJson parsing. Hope u got my point :) – Maharajan Oct 15 '19 at 12:15

0 Answers0