Avatar of Rohit Bajaj
Rohit Bajaj
Flag for India

asked on 

When making a json how should null values be handled

Suppose i make a json like {"name" : "xya", "title" :"sample"}
Now suppose someone wants to make this json and send it to the server without the title element.
There are two ways {"name" : "xya"} or {"name" : "xya", "title": null}
Now obviously it is upto the code at server side how it handles. But ideally i feel they should be handled in the same way. Or there is any reason to handle the two different. I mean in a well designed codebase should there be any difference in how this should be handled ?


Avatar of undefined
Last Comment

8/22/2022 - Mon