In the realm of programming, it is common practice to favor empty collections over null collections when there are zero elements. However, languages that interact with JSON, such as JavaScript, often interpret empty lists/objects as true and null ones as false. For instance, consider the following JSON object which would be deemed true and categorized as an object in JavaScript:
{
"items_in_stock": {"widgets":10, "gadgets": 5}
}
Similarly, this JSON object would also be considered true:
{
"items_in_stock": {}
}
On the other hand, this JSON object would be interpreted as false:
{
"items_in_stock": null
}
Is there a standard convention regarding empty objects/lists in JSON? And how does this apply to numbers, booleans, and strings?