I want to post following string as json to the server.
{ "FirstName": "John", "LastName": "Smith" }, { "FirstName": "John", "LastName": "Smith" }
But if I use below code, I am getting array list of json objects.
Gson gson = new Gson();
Type type = new TypeToken<List<Student>>() {}.getType();
String json = gson.toJson(list, type);
Output:
[{ "FirstName": "John", "LastName": "Smith" }, { "FirstName": "John", "LastName": "Smith" }]
So can anybody help me to achieve this ? Or server guy made a mistake ? I want to submit it as a post method of retrofit library.