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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:55:08+00:00 2026-05-25T16:55:08+00:00

I am using Json.Net to serialize and deserialize an object. I am experiencing an

  • 0

I am using Json.Net to serialize and deserialize an object.

I am experiencing an issue where the deserialized object recordPosted has zero as its Id.

Whereas the Serialized record will contain an Id of 180

JsonSerializerSettings jsSettings = new JsonSerializerSettings();
jsSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

var recordAsJson = JsonConvert.SerializeObject(recordToUpdate, 
                                Formatting.None, jsSettings);
//recordAsJson = {"Id":180,....


 var recordPosted = JsonConvert.DeserializeObject<record>(recordAsJson);
 //recordPosted = Id : 0

How would I resolve this?

Edit

public virtual int Id { get; private set; }
  • 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-25T16:55:08+00:00Added an answer on May 25, 2026 at 4:55 pm

    Json.NET doesn’t set private property setters by default. Either make the setter public or place a [JsonProperty] attribute on the property.

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

Sidebar

Related Questions

I am using Json.NET to serialize an object graph. For each object that is
How do you return a serialized JSON object to the client side using ASP.NET
I'm using JSON.NET implementation to serialize/deserialize .NET objects to JS and vice versa, all
I am trying to serialize a C# object to JSON using JSON.net library. The
I am trying to populate a C# object (ImportedProductCodesContainer) with data using JSON.NET deserialization.
I need to serialize and deserialize an object that contains an System.Uri property using
Background .NET 4, C#, MVC3, using JsonFx to serialize and deserialize data. Base controller
I am trying to deserialize a JSON string that was serialized by JSON.Net 4.0
I was using Json.Net to serialize dictionaries of type Dictionary, and when I added
I'm using JSON.NET to de-serialize some JSON from a web service. I'm wanting to

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.