JSON examples

Empty values

String properties: These can be left "empty" (i.e., "") in the JSON because an empty string ("") is a valid value for the string type.

Other types (e.g., numbers, booleans, objects, arrays, etc.): These cannot be left empty because an empty value is not valid for these types. If you leave them empty, it will result in an error.

Example 1: String Property

A property of type string can be left empty, like this:

{
  "Email": "[email protected]",
  "Firstname": "",
  "Lastname": "Doe"
}
  • Here, the Firstnameproperty is an empty string (""), which is valid because "" is a valid value for a string.

  • This means the property is still present in the JSON, but it has no value.

Example 2: Non-String Property

For properties of other types (e.g., numbers, booleans, objects, arrays), leaving them empty is not valid. For example:

{
  "Mobile phone number": "",
  "Marketing consent": "",
  "Array of products": ""
}
  • Mobile phone number: This is expected to be a valid phone number (e.g., "+31 6 12345678"). Leaving it as an empty string ("") is invalid because an empty string is not a valid phone number.

  • Marketing consent: This is expected to be a boolean (true or false). Leaving it as an empty string ("") is invalid because an empty string is not a valid boolean.

  • Array of products: This is expected to be an array (e.g., ["Product A", "Product B"]). Leaving it as an empty string ("") is invalid because an empty string is not a valid array.


Object example

In your definition, the Address details property is defined as an object, and it contains the following properties:

  • Street: A string representing the name of the street.

  • Number: A string representing the house or building number (can contain other characters ten numbers as well).

{
  "Marketing consent": false,
  "Email": "[email protected]",
  "Lastname": "Tester",
  "General consent": true,
  "Firstname": "User 1",
  "Address details": {
    "Street": "Konijnenberg",
    "Number": "24"
  },
  "First purchase date": "02-11-2022 22:21:00",
  "Last purchase date": "04-12-2025 22:21:00",
  "Age": 28,
  "Date of birth": "01-01-1995",
  "Company email": "[email protected]"
}


Array example

In definition, the property is defined as an array, and it contains items of a specific type (e.g., string, number, or objects).

Each string in the below array (Array of products) represents a product (e.g., "Wireless Headphones", "Smartphone Case", "Bluetooth Speaker"etc.).

{
  "Marketing consent": false,
  "Email": "[email protected]",
  "Lastname": "Tester",
  "General consent": true,
  "Firstname": "User 1",
  "First purchase date": "02-11-2022 22:21:00",
  "Last purchase date": "04-12-2025 22:21:00",
  "Created date": "01-12-2021 22:21:00",
  "Date of birth": "01-01-1995",
  "Company email": "[email protected]",
  "Array of products": [
    "Wireless Headphones",
    "Smartphone Case",
    "Bluetooth Speaker",
    "Fitness Tracker",
    "Portable Charger2"
  ]
}