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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:21:13+00:00 2026-06-08T01:21:13+00:00

I want to return some JSON data from my WebAPI controller and I want

  • 0

I want to return some JSON data from my WebAPI controller and I want the returned data to be like this.

{"rows":[{"id":1,"cell":["1","amila","amila","False"]},{"id":2,"cell":["2","rakhitha","rakhitha","False"]},{"id":3,"cell":["3","Chathura","Chathura","False"]},{"id":4,"cell":["4","Geethaga","Geethaga","False"]}]}

But when I use the below code,

return new System.Web.Mvc.JsonResult()
        {
            Data = jsonData,
            JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet
        };

the data is returned like this.

{"Data":{"rows":[{"id":1,"cell":["1","amila","amila","False"]},{"id":2,"cell":["2","rakhitha","rakhitha","False"]},{"id":3,"cell":["3","Chathura","Chathura","False"]},{"id":4,"cell":["4","Geethaga","Geethaga","False"]}]},"JsonRequestBehavior":0}

There is an additional JSON key as “Data”. I dont want that parameter and as my implementation I cant remove this “Data” part after getting it to the client side. Because the data received from the server is directly used to fill a jqGrid. The code is below.

$("#Grid1").jqGrid({
            url: 'api/matchingservicewebapi/GetUser',
            datatype: 'json',
            mtype: 'GET',
            colNames: ['', 'Name', 'FullName', 'IsActive'],
            colModel: [
                { name: 'Id', index: 'Id', width: 200 },
                { name: 'Name', index: 'Name', width: 300 },
                { name: 'FullName', index: 'FullName', width: 300 },
                { name: 'IsActive', index: 'IsActive', width: 300 }
            ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#pager',
            sortname: 'Id',
            viewrecoreds: true,
            sortorder: "desc",
            imgpath: 'Themes/images'
    }).navGrid(pager, { edit: true, add: true, del: true, refresh: true, search: true });

How do I remove this “Data” part? Because when you have this “Data” key in the returned JSON, jqGrid is not capable of filling that data to the grid.

I am using WebAPI Controller to return this data. But I tried using MVC3 controller, then this “Data” key was not in the returned JSON and data filled to the grid successfully. But I want to use WebAPI Controller. Please help to solve this.

Thank you in advance.

  • 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-08T01:21:15+00:00Added an answer on June 8, 2026 at 1:21 am

    set jsonreader option in jqGrid. like

    jQuery("#gridid").jqGrid({
    ...
       jsonReader : {root:"Data"},
    ...
    });
    

    http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#json_string

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

Sidebar

Related Questions

I want to be able to Ajax-ly retrieve JSON data from some kind of
I am having a really peculiar case. I want to return some data -
I want to return a simple json result, something like: { 12323: true }
I'm trying to return some data from twitter's JSONP results. I'm then trying to
I want to show a JSON data at my table as like here: example
As the title says, i want to retrieve my Json data values from a
I'm returning some preformtatted data from the server as a string. this is passed
I have some data Foo that I want to pass from the browser to
I want to return some errors to my jquery method. What is happening is
I want to return some files in a HttpResponse and I'm using the following

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.