Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4066

Serialize a map of key-value pairs as JSON attributes with values in response using JAX-RS

$
0
0

In the response from a REST API call I got a JSON payload.

Source JSON

It contains a parameters map containing key-value pairs like this:

{"account":    {"sample_id": 1424876658095,"parameters":       [                  {"name": "email","value": "hello@xyz.com"         },                  {"name": "first_name","value": "FIRSTNAME"         },                  {"name": "last_name","value": "LASTNAME"         }      ]   },"assests": [   {"tran_id": "1234567",   }]}

Target JSON

I would like to process this response in Java and transform or serialize it to a JSON response like this:

{"account":    {"sample_id": 1424876658095,"email_id": "hello@xyz.com","first_name": "FIRSTNAME","last_name": "LASTNAME",   },"assets": [   {"tran_id": "1234567",   }]}

Question

I am using the JAX-RS specification for the REST API, but I am not able to find any library to process the response.

Any ideas?


Viewing all articles
Browse latest Browse all 4066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>