KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I know that in most programming scenarios, the preference is for empty collections to null collections when there are 0 elements. However, most languages that consume JSON (like JavaScript) will treat empty lists/objects as true and null ones as false. For example this would be both true and an object in JavaScript: { "items_in_stock": {"widgets":10, "gadgets": 5} } But this is also true: { "items_in_stock": {} } And this is false: { "items_in_stock": null } Is there a convention on empty objects/lists for JSON? And what about for numbers, booleans, and strings?
Tags (comma-separated)
Save Edits
Cancel