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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:55:11+00:00 2026-05-27T11:55:11+00:00

Answer: I was able to figure out my own problem. I think the issue

  • 0

Answer:

I was able to figure out my own problem. I think the issue had to do with the fact that my Json was in an array format, but I didn’t realize that.

I attempted to use a different serialization class by following the person who posted here. The new class threw an exception indicating it wasn’t prepared to deserialize arrays, or something to that effect.

Here’s the resulting code that worked:

return new JavaScriptSerializer().Deserialize<IList<HubspotObject>>(inputContent);

Original question:

I’m attempting to deserialize data from a hubspot json feed for my first time into a concrete object. I’m using the example from this codespot project to help get the job done.

I’m receiving all null properties after attempting to deserialize the code, and I’m simply not sure how to trouble shoot this.

Here is an example of the json:

[{
    "blogTitle":"Practice blog",
    "feedUrl":"http://feeds2.feedburner.com/asdf",
    "guid":"asdf5-33f2-4a32-9495-8cd93f1f8252",
    "jsonUrl":"https://hubapi.com/blog/v1/asdf-33f2-4a32-9495-8cd93f1f8252.json",
    "moderated":false,
    "moderators":["asdf@asdf.com"],
    "portalId":42494,"webUrl":"blog.asdf.com/blog"
}]

Here is my class:

using System;
using System.Runtime.Serialization;


namespace Json
{
[DataContract()]
public class HubspotObject : IExtensibleDataObject
{
    [DataMember(Name = "authorDisplayName")]
    public string AuthorDisplayName { get; set; }

    [DataMember(Name = "authorEmail")]
    public string Link { get; set; }

    [DataMember(Name = "blogGuid")]
    public string BlogId { get; set; }

    [DataMember(Name = "body")]
    public string Body { get; set; }

    [DataMember(Name = "createTimestamp")]
    public int TimeStamp { get; set; }

    [DataMember(Name = "draft")]
    public bool Draft { get; set; }

    [DataMember(Name = "guid")]
    public string Guid { get; set; }

    [DataMember(Name = "jsonUrl")]
    public string JsonUrl { get; set; }

    [DataMember(Name = "lastUpdateTimestamp")]
    public int LastUpdate { get; set; }

    [DataMember(Name = "metaDescription")]
    public string MetaDescription { get; set; }

    [DataMember(Name = "metaKeywords")]
    public string MetaKeywords { get; set; }

    [DataMember(Name = "portalId")]
    public int PortalId { get; set; }

    [DataMember(Name = "postAnalytics")]
    public PostAnalytics PostAnalytics { get; set; }

    [DataMember(Name = "publishTimestamp")]
    public int PublishTimestamp { get; set; }

    [DataMember(Name = "sendNotifications")]
    public bool SendNotifications { get; set; }

    [DataMember(Name = "summary")]
    public string Summary { get; set; }

    [DataMember(Name = "tags")]
    public string[] Tags { get; set; }


    [DataMember(Name = "title")]
    public string Title { get; set; }

    [DataMember(Name = "url")]
    public string Url { get; set; }

    // WCF stores any items we did not map here
    public ExtensionDataObject ExtensionData { get; set; }
}
[DataContract()]
public class PostAnalytics : IExtensibleDataObject
{
    [DataMember(Name = "comments")]
    public int Comments { get; set; }

    [DataMember(Name = "inboundLinks")]
    public int InboundLinks { get; set; }

    [DataMember(Name = "views")]
    public int Views { get; set; }

    // WCF stores any items we did not map here
    public ExtensionDataObject ExtensionData { get; set; }
}

}

And finally, here’s the line where I deserialize:

using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(inputContent)))
        {
            // Convert the stream buffer to an object with our serializer.
            return serializer.ReadObject(stream) as HubspotObject;
        }

Again, all of the objects are null in this after deserialization. There are no exceptions thrown. If I set the attribute of one of the properties to “required”, it throws an exception when it does not populate, which makes me think I’m parsing it wrong, somehow.

Suggestions? Thanks in advance.

  • 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-27T11:55:12+00:00Added an answer on May 27, 2026 at 11:55 am

    I was able to figure out my own problem. I think the issue had to do with the fact that my Json was in an array format, but I didn’t realize that.

    I attempted to use a different serialization class by following the person who posted here. The new class threw an exception indicating it wasn’t prepared to deserialize arrays, or something to that effect.

    Here’s the resulting code that worked:

    return new JavaScriptSerializer().Deserialize<IList<HubspotObject>>(inputContent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One question whose answer I have not been able to figure out in whole
Thanks to inti's code I was able to figure out the answer! jQuery: $(document).ready(function(){
Edit 4: I was finally able to solve my own issue. See checkmark answer
Something any sophomore in CS should be able to answer, but I can't seem
I am sorry, my question is stupid, but I am not able to answer
I'm a C++ newbie, but I wasn't able to find the answer to this
Okay, so the answer to my question might not be the problem but here's
I haven't been able to figure this out despite hours of messing around, hopefully
I was wondering about something very basic but that I haven't been able to
Not being able to find the answer, and also not being able to do

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.