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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:52:37+00:00 2026-05-22T22:52:37+00:00

I want to send json data from my asp.net MVC controller in C# and

  • 0

I want to send json data from my asp.net MVC controller in C# and use those datas to draw a highcharts pie chart.

So for the moment I use this :

Dictionary<string, double> result = new Dictionary<string, double>();
result.Add("test1", 45);
result.Add("test2", 64);

var jsonResult = Json(new
{
    graphDivId = "divGraph",
    legend = "A legend",
    stats = result ,
});

jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return jsonResult;

but when I received data by an ajax call in jquery I have this :

stats:[{"Key":"test1","Value":45},{"Key":"test2","Value":64}]

but I need this :

stats:[["test1",45],["test2",64]]

Any ideas ?

  • 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-05-22T22:52:38+00:00Added an answer on May 22, 2026 at 10:52 pm

    I was playing with this a little this morning and I came up with what i have below– but it won’t work because you’ll get [{x:”testx”, y:60}….]. So that’s no good. You might be able to use it though and override a ToJSON method on the SimpleClass.

    One other thought I had (and I’m not sure it would work) is to have a collection of ArrayList’s. Since ArrayList’s are not strongly type, you can add a string and double property to them.

    Let me know how this turns out.

    What if you used a list of Simple objects. You might be able to use a key value pair or some other existing class. But you could create a simple class which will hold your data.

       class SimpleClass{
           public int x{set; get;}
           public double y{set; get;}
       } 
    
        var results = new List<SimpleClass>();
        results.Add(new SimpleClass{x="test3", y=42});        
        results.Add(new SimpleClass{x="test2", y=99});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In ASP.NET WebForms I want to pass arbitrary data from server to client and
I have a page that generates json data from several fields and I want
I am trying to get JSON data loaded from a NSURLConnection delegate to send
Just a quick question. I want to send data from Javascript to a PHP
i want to send a json string from a html webpage using javascript to
i want to send data from android application to local server (PHP) but it
I want to serve jsonp so other sites can get json data from my
I want to be a able to securely send data from my Android App
I want to send email from a Ruby application. Is there a call in
I just want to send SMS from my web application in PHP. Can anyone

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.