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

  • Home
  • SEARCH
  • 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 8387349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:11:09+00:00 2026-06-09T18:11:09+00:00

Im creating this JSONObject in javascript. var jsonBack = {id:userID,dateToday:today, dateYesterday:yesterday, wbsArrayToday:[{wbs:13232323}, {wbs:13232324}, {wbs:13232325}],

  • 0

Im creating this JSONObject in javascript.

    var jsonBack = {id:userID,"dateToday":today, dateYesterday:yesterday,
                   wbsArrayToday:[{wbs:"13232323"}, {wbs:"13232324"}, {wbs:"13232325"}],
                   wbsArrayYesterday:[{wbs:"13232333"}, {wbs:"13232334"}, {wbs:"13232335"}]};

Then i call this in my android application.

    JSONObject jsonObj = null;
    // Henter response data fra server vha. httpResponse
    HttpEntity entity1 = response.getEntity();
    if (entity1 != null) {
        InputStream is = null;
        try {
            is = entity1.getContent();
            // convert stream to string
            String result = Converter.convertStreamToString(is);

            //Remove []
            //if(result.startsWith("["))
            //  result = result.substring(1, result.length()-1);
            // Create JSON Object
            jsonObj = new JSONObject(result);
        } catch (IllegalStateException e) {
            e.printStackTrace();
            throw new HttpNodeClientException("HttpNodeClientException/IllegalStateException - createResponse():" + e.getMessage());
        } catch (IOException e) {
            e.printStackTrace();
            throw new HttpNodeClientException("HttpNodeClientException/IOException - createResponse():" + e.getMessage());
        } catch (JSONException e) {
            e.printStackTrace();
            throw new HttpNodeClientException("HttpNodeClientException/JSONException - createResponse():" + e.getMessage());
        } catch (ConverterException e){
            e.printStackTrace();
            throw new HttpNodeClientException("HttpNodeClientException/ConverterException - createResponse():" + e.getMessage());
        }

And i get an JSONException. Did i design the JSON wrong?

Heres the exception:

08-14 16:14:18.522: I/LoginActivity(418): HttpNodeClientException/JSONException - createResponse
():Value {"id":"11111111","dateToday":"14082012","dateYesterday":"13082012","wbsArrayToday":
[{"wbs":"13232323"},{"wbs":"13232324"},{"wbs":"13232325"}],"wbsArrayYesterday":
[{"wbs":"13232333"},{"wbs":"13232334"},{"wbs":"13232335"}]} of type java.lang.String cannot be 
converted to JSONObject
  • 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-09T18:11:11+00:00Added an answer on June 9, 2026 at 6:11 pm

    Use the JSONTokener class instead. It parses a string and return a JSON object.

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

Sidebar

Related Questions

So i have been creating this framework thing that basically puts together source code
I am creating this link tag: <link rel=canonical href=<%= request.url %> /> The problem
I had a huge file for creating this GUI and I have shortened it
Seems I've outdone myself. All the while I was creating this pretty little 'latest
Why is this creating a new row at the bottom with this data instead
nobody loved my first question about this: Creating Entity Framework objects with Unity for
I am creating table like this: CREATE TABLE foobar (id uniqueidentifier, foo text, bar
I have referred this for creating error message tool tips, to be displayed continuously
I've been reading this post Creating a login form in CodeIgniter based on Ion
I was trying to create Hibernate Validator bean, and run into this problem creating

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.