Are there strict rules for conversion JSON to XML and back? Are there strict rules for conversion JSON to XML and back? json json

Are there strict rules for conversion JSON to XML and back?


No... There is no strict rule as of yet.

As you imply... Although JSON can be converted to XML, the conversion cannot be robust , because XML tag lists are not, by definition, coupled to any particular data structure, where as JSON data structures are (maps and lists). Thus... JSON files , if converted to XML, cannot be losslessly converted back to JSON (unless of course you embed some nonstandard meta information in the JSON objects which are used for the XML decoding).


Personally a lot of this is going to really depend on your specifics for implementation. But in the end, the real key should be in the actual relationships that you have...

  • Object -> JSON
  • JSON -> Object
  • Object -> XML
  • XML -> Object

As really doing anything that tried to do an arbitrary conversion from XML -> JSON or vice-versa would be really hard to manage/process as you outline. But if you have a common object model in the middle, you should be fine.

Therefore, as long as your Serialization and Deserialization methods work for the respective object types, the actual processes should not have any issues.


Yes it possible. I think all your concerns could be handled cleaning if you defined how they are to be processed. I don't know of a standard way of doing it.

I think this is very telling in how you would need to go about it http://jsontoxml.utilities-online.info/

Basically You'd "encode" attributes and text data with a way to signify what's data, what's an attribute, etc. Pretty intresting and I think playing with this tool will give you some ideas of out to create a ruleset that will work for you specifications.

Biggest thing if you go forward with this is to document how the processing works and what is expected.