"location" : null // this is not really an array it's a null object
"location" : []   // this is an empty array

It looks like this API returns null when there is no location defined - instead of returning an empty array, not too unusual really - but they should tell you if they're going to do this.

Answer from Matt Varblow on Stack Overflow
🌐
JSON for Modern C++
json.nlohmann.me › api › basic_json › empty
empty - JSON for Modern C++
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_object_empty(json::value_t::object); json j_array = {1, 2, 4, 8, 16}; json j_array_empty(json::value_t::array); json j_string = "Hello, world"; // call empty() std::cout << std::boolalpha; std::cout << j_null.empty() << '\n'; std::cout << j_boolean.empty() << '\n'; std::cout << j_number_integer.empty() << '\n'; std::cout << j_number_float.empty() << '\n'; std::cout << j_object.empty() << '\n'; std::cout << j_object_empty.empty() << '\n'; std::cout << j_array.empty() << '\n'; std::cout << j_array_empty.empty() << '\n'; std::cout << j_string.empty() << '\n'; }
Discussions

JavaScript- Create an empty json array - Stack Overflow
I have to create an empty array with the following keys: "id", "action". How do I create it? More on stackoverflow.com
🌐 stackoverflow.com
Best Practices to send for Empty Values of a JSON API?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
16
16
April 22, 2024
How to send a empty array to JSON request to the API? | OutSystems
How to send a empty array to JSON request to the API? More on outsystems.com
🌐 outsystems.com
An empty array in JSON configuration file results in a null value in the configuration object
Description This is essentially a duplicate #1341 (that basically got "killed" in #3083), but it has been around 4 years and that was closed with an unsatisfactory, if not (now) incorrect, explanat... More on github.com
🌐 github.com
2
February 7, 2025
🌐
IBM
ibm.com › docs › en › baw › 24.0.x
Handling JSON null and empty arrays and objects
January 20, 2025 - The page you requested cannot be displayed (HTTP response code 403)
🌐
Laracasts
laracasts.com › discuss › channels › laravel › output-empty-arrays-and-objects-in-json
Output Empty Arrays and Objects in JSON
I'm developing an API and need to be able to output empty arrays and objects in the returned JSON. However, I'm running into a problem where empty objects/dicts are returned as empty arrays. Example Request Body: { "attributes": { "empty_array": [], "empty_object": {} } } Actual Response: { "attributes": {
🌐
Medium
medium.com › @felipegirotti › mysql-select-empty-json-array-53c1194e5efa
Mysql Select Empty JSON Array. Mysql introduces many features to work… | by Felipe Girotti | Medium
April 24, 2022 - SELECT data FROM courses WHERE JSON_EXTRACT(data, '$.codes') = JSON_ARRAY(); Bingo! The result was as expected! +---------------------------------------+ | data | +---------------------------------------+ | {"name": "Pharmacology", "codes": []} | | {"name": "Toxicology", "codes": []} | +---------------------------------------+ 2 rows in set (0.01 sec) SELECT data FROM courses WHERE JSON_LENGTH(data, '$.codes') = 0; The result as expected, only return records with empty codes
Find elsewhere
🌐
Reddit
reddit.com › r/learnprogramming › best practices to send for empty values of a json api?
r/learnprogramming on Reddit: Best Practices to send for Empty Values of a JSON API?
April 22, 2024 -

What do you choose? Getting lots of conflicting answers.

  1. Null

  2. Undefined (Omitted from JSON)

  3. Empty of that type?

    1. String = ""

    2. Number = 0

    3. Boolean = false

    4. Array = []

    5. Object = {}

CMS JSON API to be consumed by JS Framework Frontend

🌐
Micro Focus
microfocus.com › documentation › silk-performer › 205 › en › silkperformer-205-webhelp-en › GUID-0847DE13-2A2F-44F2-A6E7-214CD703BF84.html
JSON Array Structure - Micro Focus
In contrast to regular arrays from the BDL, the elements of a JSON array can be of different data types. The following data types are allowed for JSON arrays: [ ] //Empty JSON array [ 0, 1, 2, 3, 4, 5] [ “StringValue”, 10, 20.13, true, null ] [ { “Name” : “Nested Object” }, [ 10, 20, true, 40, “Nested Array” ] ]
🌐
Medium
jyotishgher.medium.com › empty-jsonissue-in-json-request-e3ebbd79644e
Empty Array Issue in JSON Request | by www.jyotishgher.in | Medium
February 14, 2025 - The “empty array issue” in JSON requests usually refers to a situation where your server-side code (e.g., in PHP, Python, Node.js, etc.) is receiving an empty array ([]) in the request body when you expect it to contain data.
🌐
GitHub
github.com › dotnet › extensions › issues › 5858
An empty array in JSON configuration file results in a null value in the configuration object · Issue #5858 · dotnet/extensions
February 7, 2025 - Change "SomeConfiguration:SomeArray" from being set to null to being set to "", an empty string. And now the array "handler" essentially works like the string "handler" that does differentiate between null and "" (though the problem there is that "" is not the same as [] in JSON either, but I might be the only one concerned with that...)
Author: dotnet
🌐
Postman
community.postman.com › help hub
How to assert json with empty array - Help Hub - Postman Community
The following paste contains data returned by our API. { "result": "OK", "sysStatisticsReport": null, "sysStatisticsData": { "sysDataStatisticsList": [{ "RLibID":"x400410000", …
Published: June 29, 2020
🌐
Drupal
drupal.org › project › services_views › issues › 2198951
Empty or no value, JSON Service always returns empty array [#2198951] | Drupal.org
September 8, 2016 - I imagine it may have to do with safe values, however this causes confusion and headaches when third party consumers of my service are expecting, for instance, an object but gets an array. Can Services View be updated so that for empty values:
🌐
OutSystems
outsystems.com › forums › discussion › 56297 › force-json-serialize-of-an-empty-array
Force JSON serialize of an empty array | OutSystems
January 12, 2020 - I have a structure I'm trying to deserialize into JSON to send elsewhere · Some of the fields in this structure are lists of objects. When <List>.Empty == true, Outsystems supposedly initializes a single empty object with all default values. This is what I want to serialize
🌐
Chrisparton
chrisparton.net › rescuing-empty-json-arrays-in-micronaut
Rescuing empty JSON arrays in Micronaut - ChrisParton.net
October 21, 2019 - I stepped through each line, and used the local mapper object to serialise an empty array at every step. This revealed the culprit pretty quickly: ... By default, Micronaut sets the serializationInclusion value to JsonInclude.NON_EMPTY, which omits empty objects/arrays from JSON to save space.
🌐
Pega
support.pega.com › question › empty-array-issue-json-request
Empty Array Issue in JSON Request | Support Center
November 4, 2023 - In our application, we consume external services. The JSON request which we send to the external API has empty arrays tagged.
🌐
UiPath Community
forum.uipath.com › help › studio
Check if an json array is empty - Studio - UiPath Community Forum
April 5, 2020 - Anyone knows how to check an json array is empty? I have gathered a few json arrays but some of them are empty, could anyone advise me how to verify if any json array is empty? Regards, Victor