Rohit Bajaj
asked on
When making a json how should null values be handled
Hi,
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 ?
Thanks
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 ?
Thanks
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER