I am posting data from registration form to server using Asynctask method in json format.
I am getting the Date of Birth from calendar in 04/13/2018 format. But after converting this in to json format it is showing like this : 04/\13/\2018.
I have tried replace("\\" "")
and replaceAll("\\\\" ,"")
functions for removing the backslash from the string but no luck. Here is my code.
JSONObject jsonObject = new JSONObject();
String fomattedDate = "04/13/2018";
Log.e("DOB", formattedDate);
//Here it is printing like normal format, i.e; 04/13/2018
formattedDate = mSelctedDate.replace("\\", "");
jsonObject.accumulate("DateOfBirth", formattedDate);
String json = jsonObject.toString();
But here it is printing like
{"DateOfBirth":"04/\13/\2018"}
Please any one help me to sort out this issue.
Thanks in Advance.