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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:10:39+00:00 2026-06-03T03:10:39+00:00

I’m new to using JSON and JSON.net and I am having trouble with an

  • 0

I’m new to using JSON and JSON.net and I am having trouble with an array of JSON objects within a JSON object. I am using JSON.net as other examples I have seen make it seem straight forward to use.

I am downloading the following JSON string from the internet:

{"count":2,"data":[{"modifydate":12345,"key":"abcdef", "content":"test file 1"},{"modifydate":67891,"key":"ghjikl", "content":"test file 2"}]}

I know that it needs to be deserialised and to do that I need a JSON class that I’ve written:

    public class NOTE
    {
        [JsonProperty(PropertyName = "count")]
        public int count { get; set; }

        [JsonProperty(PropertyName = "key")]
        public string key { get; set; }

        [JsonProperty(PropertyName = "modifydate")]
        public float modifydate { get; set; }

        [JsonProperty(PropertyName = "content")]
        public string modifydate { get; set; }

    }

So I deserialise it using:

NOTE note = JsonConvert.DeserializeObject<NOTE>(e.Result);

This works fine as I can access the count property and read it fine but everything in the data property I cannot. It seems to me to be an array of JSON objects and its that I’m having trouble with, I would like to be able to get a list of, say, all the “key” values or all the “content” strings.

I’ve tried lots of methods from here and nothign seems to have worked/I’ve not been able to find a situation exactly like mine that I can compare against.

If someone could give me a hand that would be fantastic 🙂

  • 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-03T03:10:40+00:00Added an answer on June 3, 2026 at 3:10 am

    Your JSON has nested objects whereas the object that you’re trying to deserialize to has no nested objects. You need the proper hierarchy for things to work properly:

    public class Note
    {
        [JsonProperty(PropertyName = "count")]
        public int Count { get; set; }
    
        [JsonProperty(PropertyName = "data")]
        public Data[] Data { get; set; }
    }
    
    public class Data
    {
        [JsonProperty(PropertyName = "modifydate")]
        public float ModifyDate { get; set; }
    
        [JsonProperty(PropertyName = "key")]
        public string Key { get; set; }
    
        [JsonProperty(PropertyName = "content")]
        public string Content { get; set; }
    }
    

    Now you should be able to deserialize things properly:

    var note = JsonConvert.DeserializeObject<Note>(e.Result);
    // loop through the Data elements and show content
    
    foreach(var data in note.Data)
    {
        Console.WriteLine(data.content);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,

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.