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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:49:02+00:00 2026-05-31T23:49:02+00:00

I’m new with JSON.NET and I’m trying to deserialize a JSON string to a

  • 0

I’m new with JSON.NET and I’m trying to deserialize a JSON string to a simple .NET object.
Here is a snippet of my code:

public void DeserializeFeed(string feed)
{
    JsonSerializer ser = new JsonSerializer();
    Post deserializedPost = JsonConvert.DeserializeObject<Post>(feed);

    if (deserializedPost == null)
        MessageBox.Show("JSON ERROR !");
    else
    {
        MessageBox.Show(deserializedPost.titre);
    }
}

When I do

MessageBox.Show(deserializedPost.titre);

I always get this error:

Value can not be null.

Here is my object that I want to fill with the retrieved JSON element:

using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MeltyGeeks
{
    public class Post
    {
        public String titre { get; set; }
        public String aresum { get; set; }

        // Constructor
        public Post()
        {
        }
    }
}

And here is a snippet of my JSON string:

{"root_tab":{"tab_actu_fil":{"data":[{"c_origine":"MyApp",
"titre":"title of first article",
"aresum":"this is my first Article
"tab_medias":{"order":{"810710":{"id_media":810710,"type":"article","format":"image","height":138,"width":300,"status":null}}}},
  • 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-31T23:49:03+00:00Added an answer on May 31, 2026 at 11:49 pm

    The JSON structure you have shown doesn’t match the Post object. You could define additional classes to represent this structure:

    public class Root
    {
        public RootTab root_tab { get; set; }
    }
    
    public class RootTab
    {
        public ActuFil tab_actu_fil { get; set; }
    }
    
    public class ActuFil
    {
        public Post[] Data { get; set; }
    }
    
    public class Post
    {
        public String titre { get; set; }
        public String aresum { get; set; }
    }
    

    and then:

    string feed = ...
    Root root = JsonConvert.DeserializeObject<Root>(feed);
    Post post = root.root_tab.tab_actu_fil.Data[0];
    

    or if you don’t want to define those additional objects you could do this:

    var root = JsonConvert.DeserializeObject<JObject>(feed);
    Post[] posts = root["root_tab"]["tab_actu_fil"]["data"].ToObject<Post[]>();
    string titre = posts[0].titre;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.