Search code examples
javajsonxstream

How can we get json in below format using XStream or any other parser?


In the below format my doubt is the type mentioned with every field. Can you please suggest some solution? This is a requirement from the third party who will be consuming this.

subject":{ "type":"string", "$":"Cabinet model number?" }


Solution

  • I have done this using gson API from google. Wrote a custom serializer which checks the type and value and creates the JSON object based on that.