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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:30:35+00:00 2026-06-09T07:30:35+00:00

JSONObject jsonObject; try { int ch; StringBuffer b = new StringBuffer(); System.out.println(Before second while

  • 0
JSONObject jsonObject;
try {
    int ch;
    StringBuffer b = new StringBuffer();
    System.out.println("Before second while loop");
    while((ch=is.read())!= -1) {
        b.append((char) ch);
    }
    jsonObject = new JSONObject(b.toString());
    String statusStr =  jsonObject.getString("status");
    String responseCode = jsonObject.getString("responseCode");
    Log.e("","JSON STATUS"+statusStr);
    Log.e("","JSON RESPONSE"+responseCode);

I am getting error org.json.JSONException: Value at

jsonObject = new JSONObject(b.toString());
  • 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-09T07:30:36+00:00Added an answer on June 9, 2026 at 7:30 am

    Your string in new JSONObject(String) should be in braces. Begin from { and end with }

    Also you should have JSON formatted text in your string, like in example

    {"person": {"id": "1", "firstName": "first", "lastName": "last", "middleName": "middle"}, "key" : "value" }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

try { JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++) { JSONObject json_data = jArray.getJSONObject(i);
public static void parseProfilesJson(String the_json){ try { JSONObject myjson = new JSONObject(the_json); JSONArray nameArray
I have this code JSONObject obj; try { obj = new JSONObject(readUrl(http://dleel.ps/ss.txt)); List<String> list
public void buildArrayForMonth(int month, int year, int numOfDays, JSONArray array){ JSONObject[][] monthArray = null;
I am using a JSONObject in order to remove a certin attribute I don't
I have a class like so: [JsonObject(MemberSerialization.OptIn)] public class foo { [JsonProperty(name_in_json)] public string
I´ve got a controller which gets an JsonObject from a POST method, parses it
I am keep getting NullPointerException error at line JSONObject json = userFunctions.uploadFileData(guid, photoName); in
This answer seems to show how to make a JSONObject. NSString *jsonString = @[{\id\:
I tried to get an answer from server and conver it to JSONObject .

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.