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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:16:49+00:00 2026-06-02T01:16:49+00:00

I have a very basic ASP MVC application exposing a static list of publications

  • 0

I have a very basic ASP MVC application exposing a static list of publications (see code and result below).

Code:

    public JsonResult Index()
    {
        List<Publication> list = new List<Publication>() {
            new Publication() { Id = 1, Name = "War and Peace" },
            new Publication() { Id = 2, Name = "Harry Potter" },
            new Publication() { Id = 3, Name = "Cat in the Hat" }
        };
        return this.Json(list, JsonRequestBehavior.AllowGet);
    }

Result:

[{“Id”:1,”Name”:”War and Peace”},{“Id”:2,”Name”:”Harry Potter”},{“Id”:3,”Name”:”Cat in the Hat”}]

When I attempt to consume it in Android I get the following error:

04-15 12:00:57.331: W/System.err(209): org.json.JSONException: A JSONObject text must begin with ‘{‘ at character 1 of [{“Id”:1,”Name”:”War and Peace”},{“Id”:2,”Name”:”Harry Potter”},{“Id”:3,”Name”:”Cat in the Hat”}]

I can remove the starting [ and ending ] and it stops the error from appearing. The other option is to put the { publications: logic at the beginning of the android code, but that seems like it should already be there.

How can I update the code in the MVC application to produce a “ready to be consumed” version of JSON?

Any help is greatly appreciated.

  • 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-02T01:16:52+00:00Added an answer on June 2, 2026 at 1:16 am

    First, you shouldn’t modify your json string when received, because it may mess up with the parsing.

    Second, your Json string is in array format because it starts with [ and ends with ]. So, instead of using JSONObject, you should use JSONArray.

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

Sidebar

Related Questions

I'm a little new to asp.net mvc and I have a question (very basic).
I have a very basic email submission form in my ASP.NET MVC 3 app.
Probably a very basic beginner question. Imagine the following situation: I have an ASP.NET
I have some very basic semaphore code that works great on Linux, but cannot
I have simple jQuery Mobile site created using asp.net mvc 2 and uses basic
I have a very basic ASP.NET web site. It has a single page (TestPage.aspx)
I'm just starting to play with asp.net mvc and I've got a very basic
I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which
I have an ASP.NET MVC application that is calendar-like. As per the NerdDinner example,
I've got a very basic ASP.Net MVC project where I'd like to use 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.