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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:02:18+00:00 2026-06-14T20:02:18+00:00

I was lately trying to deserialize JSON content using JSON.Net API with dynamic datatype.

  • 0

I was lately trying to deserialize JSON content using JSON.Net API with dynamic datatype.

I searched the forum really hard and found out that it is indeed possible to do so in WinRT.

A sample JSON could be:

string json = "{\"message\":\"Sample Message\"}"

I used the following format:

dynamic result = JsonConvert.DeserializeObject<dynamic>(json);

It successfully deserializes the content to result. But when I try to access it using a syntax like:

string message = result.message;

It results in an error which is:

‘object’ does not contain a definition for ‘message’ and no extension method ‘message’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

I tried with many json samples all over the internet but the error remains the same.
Truly speaking, I tried it a some hours back it ACTUALLY worked! But I couldn’t find what I am missing this time.

PS: I need to use dynamic only because my actual Json contains dynamic field names.
Once it is like:

{"New York" : "Its in United States"}

And sometimes it is like:

{"London" : "Its in United Kingdom"}

(Crap example though! 😛 )
The json2csharp classes method won’t work here I guess and if there is some secondary and more efficient method. Please guide me in. The real Json which I am trying to parse is very complex. I would post it if it needs to be posted.

  • 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-14T20:02:19+00:00Added an answer on June 14, 2026 at 8:02 pm

    I use JSON.NET in a personal project of mine, but deserialize using square bracket syntax like this:

    Id = jsonResult["object_id"].ToObject<int>(),
    

    To actually get the JSON object I do this:

    var response = await client.GetStringAsync(parameters);
    var jsonResult = JToken.Parse(response)["results"].Children();
    

    I adopted this methodology after doing a good bit of research into the different ways to use JSON.NET. I seriously considered going the dynamic route after reading this article: http://www.west-wind.com/weblog/posts/2012/Aug/30/Using-JSONNET-for-dynamic-JSON-parsing

    However, in the end I decided against dynamic objects because when I fill my normal objects with the square bracket syntax I return immediately to a strongly-typed environment where intellisense will begin to catch any errors I may make. I combine this with a LINQ query and fill a set of fairly complex objects in a relatively few number of lines.

    For me, dynamic objects are one more weakly-typed step in the deserialization process that I prefer to avoid if possible.

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

Sidebar

Related Questions

I've been trying to consume a .net WCF rest service using JAX-WS lately. Due
I've been developing a Vb.Net app lately, and I'm trying to make it as
I've been on a tear lately trying to learn everything I can about .Net
Lately I have been working on trying facial recognition with the Kinect, using the
I've been trying to research this lately. Is there an android API that I
I'hv been trying to learn the Google App Engine's Channel API lately. I tried
Lately I have been trying my hands on Eclipse IDE for java development. I
Lately, I've been trying to learn C++ from this website . Unfortunately whenever I
I've been trying out MVC 4 lately. Started with the developer preview, and now
Hey, as of lately, I've been trying to find good ways to smoothen out

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.