I have a JSON string that I convert to JSON using GSON library down below:
Gson g = new Gson();
String json = "{\"user\":\"c8689ls8-7da5-4ac8-8afa-5casdf623302\",\"pass\":\"22Lof7w9-2b8c-45fa-b619-12cf27dj386\"}";
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
out.writeBytes(g.toJson(json));
out.flush();
out.close();
However when I send the actual post request, I get the following error message:
{"message":"Invalid JSON: Unexpected string literal\n at [Source: UNKNOWN; line: 1, column: 108]","_links":{"self":{"href":"/endpoint","templated":false}}}
Im not sure what is wrong with my JSON string as it looks properly formatted and is later converted to JSON. What would the cause of this error be?