Reputation: 17820
I have an information system to which we can pose queries in XML like this:
<Query>
<Condition>
...
</Condition>
<LogicalOperator>AND</LogicalOperator>
<Condition>
...
</Condition>
<LogicalOperator>AND</LogicalOperator>
<Condition>
...
</Condition>
</Query>
This sibling order is imporant and enforced by schematron (LogicalOperator between Condition).
How can I represent this data in JSON, preserving its semantic? The JSON becomes something like
"Query": {
"Condition": [{...},{...},{...}] ,
"LogicalOperator": ["AND","AND"]
}
And a lot of semantic information is lost. How can I encode all this information in JSON
Upvotes: 1
Views: 204
Reputation: 17820
"Query": [{...},"AND",{...},"AND",{...}]
Deserialize with gson using the mixed-type-collection recipe and serialize with jaxb
Upvotes: 1