I'm in the process of designing and developing a RESTful API. I'm taking a pragmatic, resource oriented approach to the API (resource oriented, uniform interface, addressability, but no real HATEOAS). One point I'm not sure about though is how to approach null values in objects.
Should I include fields with null values in the APIs responses?
Example:
{
"fieldA": "AAA",
"fieldB": null
}
Or, should I just leave out these fields altogether if the system has no data for these fields?
Example:
{
"fieldA": "AAA"
}