0

I have an application that gets data(json) from my webservice(rest). I can successfully get my json. What i did is this:

            try{
            DefaultHttpClient httpClient = new DefaultHttpClient();
            httpClient.setCredentialsProvider(credProvider);
            HttpGet httpGet = new HttpGet(url);

            HttpResponse httpResponse = httpClient.execute(httpGet);
            HttpEntity httpEntity = httpResponse.getEntity();
            inStream = httpEntity.getContent(); 
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));

            StringBuilder sb = new StringBuilder();
            String line = null;

            while((line = reader.readLine()) != null){
                sb.append(line);
            }

            inStream.close();
            json = sb.toString();
        }catch(Exception e){
            logs...
        }

        // and so on...

But when i try to print my json (String), since I have a url got from that json... my url looks like this something\/image\/myimage.png insted of something/image/myimage.png My problem where and how can i remove the additional "\"in my url. Is this an escape character? Any ideas? It would be great if you share some. Though I'm currently also looking for a fix. But as of now, I can hardly find it.

1

1 Answer 1

1

Use str.replaceALL("\\\\","") to remove the escape characters.

Sign up to request clarification or add additional context in comments.

1 Comment

and now i wonder why nothing has changed.. it's because that's the way logcat displayed the trace...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.