Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

null vs missing key in REST API Response [closed]

$
0
0

Say in my application, some users give us their last name, and others do not. In a REST API response, which body is preferred:

With a “null” value:

{"firstName": "Bob",
 "lastName": null}

Or just a missing key:

{"firstName": "Bob"}

Viewing all articles
Browse latest Browse all 148

Trending Articles