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 7177161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:39:17+00:00 2026-05-28T16:39:17+00:00

I used the link for JSON RPC. I am getting a response as expected.

  • 0

I used the link for JSON RPC. I am getting a response as expected. But when i try to parse the response, it’s giving me json error.

My code:

JSONEntity entity = new JSONEntity(jsonRequest);
    HttpPost request = new HttpPost("http://192.168.1.150/jsondemo12/service.asmx");
    request.setEntity(entity);
    HttpResponse response = httpClient.execute(request);
    StatusLine statusLine = response.getStatusLine();
    int statusCode = statusLine.getStatusCode();
    if (statusCode == 200) {
        HttpEntity httpEntity = response.getEntity();
        InputStream content = httpEntity.getContent();

        BufferedReader reader = new BufferedReader(
                new InputStreamReader(content,"iso-8859-1"),8);
        String line;
        while ((line = reader.readLine()) != null) {
            builder.append(line);
        }
        content.close();
    } else {
        Log.e(AndroidJSONActivity.class.toString(), "Failed to download file");
    }


    strJSONValue=builder.toString();

    txtViewParsedValue.append("\n+++++++++++++\n"+strJSONValue+"\n");
    try {
        parseJSON();
    } catch (JSONException e) {
        Log.e("error","Error while parsing!!!");
        e.printStackTrace();
    }
    Log.e("response", strJSONValue);
public void parseJSON() throws JSONException
    {
        String attr1="",attr2="";
        jsonObject = new JSONObject(strJSONValue);
        JSONArray  result = jsonObject.getJSONArray("result");    <- Error in this line!!!
        for(int i=0;i < result.length();i++){
            JSONObject e = result.getJSONObject(i);
            attr1 = "ExhibitorID: "+ e.getString("ExhibitorID");
            attr2 = "ExhibitorName: "+e.getString("ExhibitorName");
        }
        strParsedValue=attr1+"\n"+attr2;
        Log.d("Parse", attr1);
        Log.d("Parse", attr2);

        txtViewParsedValue.append("\n**********\nParsed Value: \n");
        txtViewParsedValue.append(strParsedValue);
    }

The result i get in “strJSONValue” is string format, without the starting and ending double quotes.
Like:

{"id":2,"result":"[
{\"ExhibitorID\":42, etc....}
]"}

The result string is as per requirement,but i am not able to parse the string into the JSON Object as per requirement. It gives error in Logcat: org.json.JSONException: Value <content of the string> at result of type java.lang.String cannot be converted to JSONArray

Please help me.
Thanks

  • 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-05-28T16:39:18+00:00Added an answer on May 28, 2026 at 4:39 pm

    your result is actually returning a string not a json array. it will return json array if your json format would be like this

    {
      "id": 2,
      "result": [
        {
          "ExhibitorID": 42
        }
      ]
    }
    

    currently it is in this form:

    {
      "id": 2,
      "result": "[ {\"ExhibitorID\":42, etc....} ]"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to get parse JSON response for the following link: https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token= The response
I've seen (and used) code to have a link spawn a javascript action many
the methods below used to work but now I get this error: Error: Sys.Net.WebServiceFailedException:
I used this link http://blog.androgames.net/85/android-accelerometer-tutorial/ to create an accelerometer. But I want that this
I have used href link in the flexigrid rows. on Click it takes me
I have 3rd party libraries for my mac applications which used to link nicely
i have a DTD file which i used to accessed through this link: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
This code is being used on a Chrome Extension. When I call the "showOrHideYT()"
I have the following code, however im having a problem getting window.location to work
In GNU C, The Result is 13. Because the static link is used. Otherwise,

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.