I have below json stored in sharedPref as a single line string
[
{
"url":"http:\/\/google.com",
"feedType":"Automotive"
},
{
"url":"http:\/\/google.com",
"feedType":"Automotive"
}
]
I am checking that url is already present in json string using below code but its not working since json is escaped with \ backslash.
String url = "http://google.com";
String jsonString = '[{"url":"http:\/\/google.com","feedType":"Automotive"},{"url":"http:\/\/google.com","feedType":"Automotive"}]';
if(jsonString.contains(url)) {
Toast.makeText(context, "URL already exists.", Toast.LENGTH_LONG).show();
return false;
}
Please help how can i check that url is already exist in string to avoid dupes.