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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:19:51+00:00 2026-06-12T19:19:51+00:00

Json.Net typically serializes a Dictionary<k,v> into a collection; MyDict: { Apples: { Taste: 1341181398,

  • 0

Json.Net typically serializes a Dictionary<k,v> into a collection;

"MyDict": {
  "Apples": {
    "Taste": 1341181398,
    "Title": "Granny Smith",
  },
  "Oranges": {
    "Taste": 9999999999,
    "Title": "Coxes Pippin",
  },
 }

Which is great. And from looking around on SO it seems to be what most people want. However, in this particular case, I want to serialize between my Dictionary<k,v> and the Array format instead;

"MyDict": [
    "k": "Apples",
    "v": {
        "Taste": 1341181398,
        "Title": "Granny Smith",
    }
  },
    "k:": "Oranges",
    "v:": {
        "Taste": 9999999999,
        "Title": "Coxes Pippin",
    }
  },
]

Is there an easy way to do this with my existing field type? Is there an attribute I can annotate for instance?

  • 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-12T19:19:52+00:00Added an answer on June 12, 2026 at 7:19 pm

    Ah, it turns out this is as straightforward as I’d hoped. My Dictionary<k,v> is subclassed already and I found that I can annotate it with [JsonArrayAttribute]. That gives me exactly the format I need;

    "MyDict": [
      {
        "Key": "Apples",
        "Value": {
            "Taste": 1341181398,
            "Title": "Granny Smith",
        }
      },
      {
        "Key:": "Oranges",
        "Value:": {
            "Taste": 9999999999,
            "Title": "Coxes Pippin",
        }
      },
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does .NET 4 come with any class that serializes/deserializes JSON data? I know there
I've been looking into several JSON parsers for .NET ( LitJSON , JsonExSerializer and
Possible Duplicate: Deserializing JSON into an object with Json.NET Any ideas of how to
I'm trying to use JSON.Net to deserialize a JSON object into a C# object.
How do I setup Newtonsoft Json.net to deserialize this text into a .NET object?
I was using Json.Net to serialize dictionaries of type Dictionary, and when I added
It seems impossible to (de-)serialize a generic dictionary using Json.NET out of the box.
With JSON.NET I can serialize a generic list into a JSON string: return Json(new
I am using Json.net to convert a json string into a dynamic. When I
I'm using JSON.Net for serializeation. I need my data to look like this json

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.