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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:47:10+00:00 2026-06-01T06:47:10+00:00

i am wondering if it is possible to return multiple objects with a JSON

  • 0

i am wondering if it is possible to return multiple objects with a JSON result in MVC.
At the moment i have no problem to return a single object.

public ActionResult AddToBasket(int quantity, int productdetailid) 
{
    // more code here
    return Json ( new { Name = p.Product.Name, Price = p.Price});
}

This returns a single anonymous object in my ajax call.What i wanna do is return multiple Names and Prices to fill a table in my view.

So basicly i wanna update(renew) the cookie every time the user adds a item to his basket and update the basket which is a html table.

Thanks 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-01T06:47:12+00:00Added an answer on June 1, 2026 at 6:47 am

    Just return some enumerable if you want an array:

    return Json ( Enumerable.Range(0, 10).Select(i => new { Name = "N" + i, Price = i });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering is it possible to create multiple instances of a single Activity
I was wondering if it's possible to store the return json in a hidden
I'm wondering if it is possible to return a result set with column names
Possible Duplicate: how to “return an object” in C++ I am wondering if there
I'm wondering is it possible to limit the result of a SQL request? For
I'm wondering if the following is possible: class A { public int SomeMethod() {
I was wondering if it's possible to write a function that accepts multiple generic
I'm wondering if (and if so, how) it's possible to make RESTEasy return an
I'm wondering if it is possible to observe a CDI event with multiple JSF
I was wondering how (if possible) would you access the return value of an

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.