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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:29:09+00:00 2026-06-04T17:29:09+00:00

I have a RESTful webservice which receives JSON and it deserialises it into a

  • 0

I have a RESTful webservice which receives JSON and it deserialises it into a c# class using the DataContractJsonSerializer, though this can be changed.

Its purpose is to update fields on a resource

e.g.:

{
    "firstName" : "Martin"
}

I don’t necessarily want to update all the fields, and I was hoping to find a way to detect fields which are and are not unspecified in the JSON.

I can’t find a way to do this however because I don’t know how to tell the difference between an unspecified field and a field which should be updated to null

e.g: (don’t update any fields):

{}

vs: (update the firstName field to null)

{
    "firstName" : null
}

What is the best way to approach this?

  • 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-04T17:29:11+00:00Added an answer on June 4, 2026 at 5:29 pm

    I think you can use a field initialized with some random string

    public class TestClass
    {
        public string firstName = "some string";
    }
    

    If you deserialize using {"firstName" : null}, firstName will be null. if you deserialize using {} firstName won’t change (some string)

    PS: Don’t use DataContract or DataMember attributes if you are using DataContractJsonSerializer

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

Sidebar

Related Questions

I have a restful webservice which receives some structured data which is put straight
I have a restful web service which can deal with DTOs in json format
I have created a RESTful PHP web service using Lithium which contains comments, each
I have a RESTful API serving JSON. I'm calling it like this: - (void)viewDidLoad
I am using Jersey and JAXB to build a simple RESTful webservice I have
I have a Flex client making RESTful calls to a webservice using HTTPService. The
I have a Restful web service. Reservation room can change. Which URI is better
lets say i have a Restful webservice (for my record-class) on a GlassFish, accessable
I currently have a RESTful webservice which recognises a client via it's session. I
i have a restful webservice configured using cxf and camel. My config xml is

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.