I am working to retrieve data from an API call. For the login part, a simple text response is sent by the site to which I am connecting.
Sample response is given below:
{"code": "OK",
"data": {"session_id": "myemail@domain.com:uJoaY1KlTWBchJpGHeZVZWs3"},
"user": "myemail@domain.com"}
I want to extract the various values from above response. What kind of object do I have to create that maps correctly to each of the elements in the response? Also, I thought of using a hashmap as part of my object- is that the correct approach? What is the best way to map the above data to a Java object?
That data is in JSON format. There are several Java libraries to parse JSON data, for example Google GSON.