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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:57:35+00:00 2026-05-24T05:57:35+00:00

The json needs to be in this format: var data = [ [‘Heavy Industry’,

  • 0

The json needs to be in this format:

var data = [
            ['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14], 
            ['Out of home', 16],['Commuting', 7], ['Orientation', 9]
          ];

But in my action method I can’t figure out how to construct the json to be rendered in that format. Here is what I have:

var json = new[] {
                new[] {"Pending", summaryData.Sum(a => (int)a.Pending).ToString() },
                new[] {"Completed", summaryData.Sum(a => (int)a.Completed).ToString()}
            };

        return Json(json, JsonRequestBehavior.AllowGet);

Which returns the following JSON:

[["Pending","146"],["Completed","914"]]

This is close except that their are quotes around the numeric values and jqPlot doesn’t seem to like it. Unfortunately if I try to do a Int32.Parse(…) on it I get an exception.

Any ideas how to best do this?

Thanks

  • 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-24T05:57:37+00:00Added an answer on May 24, 2026 at 5:57 am

    I’m guessing the error you get when you try to use Int32.parse is something like “No best type found for implicitly-typed array.” When using an implicitly typed array and the values in that array are of different types, the compiler doesn’t know what type to infer for the array.

    You can get around the error by telling the compiler a type for the arrays:

    var json = new[] {
                    new object[] {"Pending", summaryData.Sum(a => (int)a.Pending) },
                    new object[] {"Completed", summaryData.Sum(a => (int)a.Completed) }
                };
    

    This should serialize the array the way you want it.

    As for jqPlot, the quotes around the number are causing a problem because the plugin most likely required the second item in the array to be of type Number.

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

Sidebar

Related Questions

I am recieving JSON data in this format:- { sEcho:1, total:1710, aaData:[ [ Help,
i need to return a JSON with this format: {answers: [{id: 93, value:Ahstron}, {id=94,
I have this swf (flash) file that provides the json that needs to be
This will work : var json = { 'items': [{ 'id': 72, 'quantity': 1,
I have a requirement where i need to loop through JSON Format data and
I need to send some data to a web page, ideally in json format
I need to transform my nested sets structure (mysql) into json for this spacetree
I need a tool which generates random JSON objects. I want to use this
I need to render JSON data in my JSPs for some AJAX requests. I'd
I am building a Railo app which deals with a lot of JSON data

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.