Friday, August 30, 2019

java - Hashmap converting to JSONObject every `/` in the hashmap item value is replacing with this `/`

When converting HashMap to JSONObject, every / in the string will replacing with this \/why is like this?? any solution for this?
my string is



 String sumValue= "mZftaLXj7UN19zxc/7n/UZdf....";


but i'm getting like this



D/b: getBody{"****":"*****","*****":"***",SUMHASH":"mZftaLXj7UN19zxc\/7n\/UZdf****"}



I'm tried like this



 public byte[] getBody() {

String sumValue= "mZftaLXj7UN19zxc/7n/UZdf.....";

HashMap params2 = new HashMap();
params2.put("***", "*****");
params2.put("***", "*****");

params2.put("SUMHASH", sumValue);

Log.d(TAG, "getBody" + new JSONObject(params2));

try {
return new JSONObject(params2).toString().getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}}



Given below is the output while doing



System.out.println("getBody" + new JSONObject(params2)); 


enter image description here

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...