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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:42:57+00:00 2026-06-04T16:42:57+00:00

With JSON.NET I can serialize a generic list into a JSON string: return Json(new

  • 0

With JSON.NET I can serialize a generic list into a JSON string:

 return Json(new { success = true, data = JsonConvert.SerializeObject(units) });

but how can I serialize a generic list into JSON objects. This would have the advantage that I do not need this on client side:

var jsonData = $.parseJSON(units);
  • 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-04T16:42:59+00:00Added an answer on June 4, 2026 at 4:42 pm

    Don’t serialize a part of the object, serialize the entire object:

    return Content(JsonConvert.SerializeObject(new { success = true, data = units }), "text/javascript");
    

    The built-in Json method is hard-coded to return a result that uses the built-in (somewhat limited) .NET JavaScript serializer. If you want to get something as easy to use as that, add your own “Json” method into your base controller class that does the same thing with Json.NET.

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

Sidebar

Related Questions

I have a service that attempting to serialize a list into JSON (using JSON.NET)
I'm new with JSON.NET and I'm trying to deserialize a JSON string to a
I have a ASP.NET web service decorated with System.Web.Script.Services.ScriptService() so it can return json
I have constructed several web services that successfully serialize my .NET types into JSON.
When working with JSON, I can use NuGet to add JSON.Net and this allows
Can someone explain how to use JSON-RPC.net in my application for windows phone. When
I have a series of .NET WCF RESTFul services that can produce either JSON
I started to use Json.NET to convert a string in JSON format to object
I am using Json.NET to serialize an object graph. For each object that is
I wish to use JSON.Net on a brand spankin new Mono class library (say

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.