Question Detail

I am requesting for an API but it is returning me 

I have printed my Objects Value before send to Server that is fine without any \" but when i get it from Server it is looking like below Json

{"status":false,"statusCode":400,"error":{"paymentId":"Invalid Payment"},"success":"","data":"\"PAY-87941918BKW2EW831LKIA3JI\""}

Please help

Why I am getting "\ from my String Object ?


Thread Reply

Anonymous

- 9 months ago

Check your contentType maybe your were sending Json which automatically add " with your String because of it is converting your string into Json

or Change your value passing way direct String to 

this 

Call<ResponseBody> call = getResponse.uploadFile( fileToUpload,
YOURSTRINGVALUE),
Integer.parseInt(album.getCoverIndex()));

to

Call<ResponseBody> call = getResponse.uploadFile(
        fileToUpload,
        RequestBody.create(MediaType.parse("text/plain"), YOURSTRINGVALUE),
        Integer.parseInt(album.getCoverIndex()));