A
A
Alexander Momot2016-06-03 12:37:50
JSON
Alexander Momot, 2016-06-03 12:37:50

Reduction of the same type of data from json and xml for comparison, what is better for mapping?

There is a situation: logically, the data in json and xml (from different systems) are the same, but can be located in different places in the hierarchy (both there and there), called a little differently and duplicated. Example

{ 
 "data": {
  "username": "foo",
  "userpass": "bar"
 }
}

<serverResponse>
  <credentials>
   <name>foo</name>
   <password>bar</password>
 </credentials>
 <cypher>
  <pass>bar</pass>
 </cypher>
</serverResponse>

The essence of the example is that the data in the "username" and "userpass" fields is logically the same as in the xml in "name" and "pass". In this case, password and pass will be the same. Combat xml and json that need to be "mapped" to each other, 20 times more.
Recommend a library, or approach, to universalize (even out) such a spread, creating a single structure in the application's memory, with or without a hierarchy.
Interested in:
- With the ability to compile dictionaries of synonyms
- Equalize different levels of hierarchy
- Create unambiguous bindings "source key" -> "mapped key", "mapped key-synonym", etc.
I can "read" options for python, java, php, but implementation in php is preferable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
guras256, 2016-06-03
@AlexMt

Java: for parsing Json and xml into Jackson objects, for sparring between dozer objects.
Everything is very simple and clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question