When it's empty, it comes as an array [] instead of {}

We have configured the HTTP services to call the our microservice apis. When we get the response of an API, it comes as a single object {} data is there. But when it’s empty object, it comes as an array ; which conflicts with the data type that we’re maintaining.

null is a legal value (and reserved word) in JSON, but some environments do not have a “NULL” object (as opposed to a NULL value) and hence cannot accurately represent the JSON null . So they will sometimes represent it as an empty array. Whether null is a legal value in that particular element of that particular API is entirely up to the API designer.