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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:25:25+00:00 2026-06-12T18:25:25+00:00

How do I deserialize the following JSON with Web API (JSON.Net)?: { action: edit,

  • 0

How do I deserialize the following JSON with Web API (JSON.Net)?:

{
    "action": "edit",
    "table": "MainView",
    "id": "row_1377",
    "_group_id": "999",
    "data": {
        "ROTATION": "1", // This name/val can change
        "EQUIPMENT": [{
            "id": "6"
        },
        {
            "id": "8"
        }],
        "NOTES": ""
    }
}

The values in data represent columns and can change, so I can’t make a set-in-stone object with e.g. a string named “NOTES” as in json.net deserialize string to nested class.

Notice EQUIPMENT contains multiple values. When it was previously just a “string:string” like NOTES, this JSON deserialized data into a Dictionary<string, string>, but now I need it to behave like its own dictionary. My last attempt was to deserialize into the following type:

public class EditorSubmissionJoined
{
    public string _group_id { get; set; }
    public string action { get; set; }
    public string table { get; set; }
    public string id { get; set; }
    // "public" added below due to mistake noticed by Maggie Ying
    public Dictionary<string, object> data { get; set; } // Trouble
}

I was hoping that the object could contain anything in data whether a KeyValuePair (like NOTES) or a dictionary (like EQUIPMENT).

I’ve also tried Dictionary<string, ICollection<Object>>, Object, and even ICollection<Dictionary<string, Object>>.

The problem is that my controller always gets EditorSubmissionJoined with nothing but null values:

public void Put(EditorSubmissionJoined ajaxSubmission) {
    // ajaxSubmission has only NULL values
}
  • 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-12T18:25:26+00:00Added an answer on June 12, 2026 at 6:25 pm

    There’s a few ways you can do it. One way is to simply use a JObject and access the fields by name e.g. : jsonObject["data"]["ROTATION"]. You can “deserialize” that with JObject.Parse and just “parse” the JSON text into a JObject.

    Alternatively you can write your own JsonConverter and tell JSON.net to use that converter when deserializing a specific type (e.g. JsonConverterAttribute). This requires parsing parts of the JSON text manually, in the ReadJson override, and really depends on what data you expect.

    You can also use the dynamic approach that Preston commented on.

    Which approach you pick depends on how strongly-typed you want things to be.

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

Sidebar

Related Questions

I am currently using Json.Net to deserialize my JSON. I now have the following
I want to deserialize the following json data https://mtgox.com/code/data/getDepth.php . I keep getting an
I am using System.Web.Helpers.Json to deserialize some JSON into dynamic in NET 4. The
I'm using JSON.NET to deserialize some JSON returned from a web service. Unfortunately, i'm
I'm trying to deserialize json data services recieved from a web server into an
I would like to deserialize the following json using DataContractJsonSerializer: coordinates: [ [ 18.008966033966707,
I like to use GSON to deserialize the following JSON String. { type: FeatureCollection,
I've got the following JSON string to deserialize: [{application_id:1,application_package:abc},{application_id:2,application_package:xyz}] I'm using DataContractJsonSerializer method. It
I'm using JSON.NET to de-serialize some JSON from a web service. I'm wanting to
I am trying to deserialize the following JSON, but I really have no idea

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.