Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:03:12+00:00 2026-06-17T21:03:12+00:00

I have a web service that returns data in the form of json. but

  • 0

I have a web service that returns data in the form of json. but the returned data actually not in json format because for some key values like ids it gives the values of numbers without any quotes because of that when I am creating an object it throws an exception so my requirement is simple how can i surround quotes to the numbers that don’t have quotes.

{"name":"pragnani","job":"android developer","experience":"fresher","age":22,"id":10}

Here Id and age are not there with quotes, I want to replace them with quotes.
Don’t simple post substring kind of a thing because it won’t work because web services return huge amount of data . And I am using one separate class to retrive data from different web services .so Please help me….

Edit:
Here is the data

"[{\"PracticeID\":36,\"PracticeName\":\"Dr. John Doe\",\"DBServerName\":\"DBSERVER8\"}]"

this is the method to retrive data

@Override
protected String doInBackground(String... aurl) {
    String results="";
    try {
             HttpClient httpClient = new DefaultHttpClient();
             HttpPost post = new HttpPost(aurl[0]);
             post.setHeader("content-type", "application/json");
                 StringEntity entity = new StringEntity(dto.toString());
                 post.setEntity(entity);
                 HttpResponse resp = httpClient.execute(post);
                 String respStr = EntityUtils.toString(resp.getEntity());
                 results=respStr.trim();
                 results=results.replace("]\"", "]").replace("}", "\"}").replace("\":", "\":\"").replace("}\",","},");
                 results=results.replace("\"[", "[");
                 results=results.replace("\\\"", "\"");
                 results=results.replace("\"\"", "\"");    

                 String[] arr=results.split("\\{");
                 if(arr.length<=2)
                 {
                     results=results.substring(results.indexOf("[")+1,results.indexOf("]"));
                 }
                 else
                 {
                     results=results.replace("[", "{\"result\":[").replace("]", "]}");
                 }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return results;
}

How to I convert it into json String….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:03:13+00:00Added an answer on June 17, 2026 at 9:03 pm

    JSON allows numeric values in its structure (I.E. unquoted numbers). They can be intergers floats or any other numeric type that JavaScript would recognize.

    Allowed types: Objects, Arrays, Numerics, Strings, Booleans, null.

    As opposed to normal JavaScript all Object keys have to be quoted, that is true! Asides from that you can directly use numerics at will.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that returns a raw string of JSON data (sample
I have a web service that returns some XML data using a RESTful API.
I have a Web Service call that returns reporting data using Linq-To-Entity (strongly type
I have a web service, that simply returns a lot of data over a
I have a basic web service that returns the following object as JSON: public
I have a web service that returns List<SampleClass> . I take data from database
I have a web service that returns this string via the jQuery $.ajax() call
I have a web service that returns the binary array of an object. Is
I'm dealing with times formats in Restkit, I have a web service that returns
I have a WSE web service that returns a list of items in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.