[Moims-dai] JSON and/or XML

david at giaretta.org david at giaretta.org
Tue Nov 22 17:58:10 UTC 2022



It may be even easier than I thought - Jackson supports XML
(de-)serialisation so that it is trivial to use JSON:






or this XML:







without extra annotations




From: MOIMS-DAI <moims-dai-bounces at mailman.ccsds.org> On Behalf Of David
Giaretta via MOIMS-DAI
Sent: 22 November 2022 16:53
To: MOIMS-DAI List <moims-dai at mailman.ccsds.org>
Cc: david at giaretta.org
Subject: [Moims-dai] JSON and/or XML


Hi Steve


At the end of the call today we spoke about JSON and/or XML.


I realised that I am just writing very simple POJOs (Plain Old Java
Objects), with Jackson annotations to serialise and de-serialise to/from
JSON, but one can do exactly the same conversions to XML using JAXB


Unless the annotations interact in some way - which is always possible - one
can use the same code with both sets of annotations in and then when one
chooses which serialisation - JSON or XML - to use then one calls one or
other specific methods in the Generic Adapter.


This would allow us - assuming the annotations work together OK - to mix and
match XML and/or JSON serialisations.

The Switchboard tells us which one the other side prefers BUT since the HTTP
headers tell us whether we are receiving XML or JSON then it does not

The only thing we need to do in the BB is

1.	Ensure the switchboard has the preferred serialisation (although as
mentioned this may not strictly be necessary) and
2.	In the BB specify the serialisation for XML in a similar way to JSON
- of course this does limit the XML that is sent but at least it is XML.


What do you think?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ccsds.org/pipermail/moims-dai/attachments/20221122/f1734e32/attachment.htm>

More information about the MOIMS-DAI mailing list