Monday, 17 July 2017

java - Converting a URL in JSONObject to a String value

My required JSON is :



[    "URI" : "http://192.168.1.1/"    ]


I use the following way to create this JSON:



{    
String requiredUri = "http://192.168.1.1/";

JSOnObject jsonObject = new JSONObject();
jsonObject.put("URI", requiredUri);
String jsonData = jsonObject.toString();
}


This time I get get the output as :



[
"URI" : "http:\/\/192.168.1.1\/"

]


Please tell me what should be done so that these forward slashes are not included in the resultant json.

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...