Explanation & Hint:
When writing a JSON array, the following two syntax rules apply:
- Each value in the array is separated by a comma.
- Values are enclosed in square brackets.
To clarify further:
- Values within a JSON array are separated by commas. This is how the array denotes the end of one value and the beginning of another.
- A JSON array is always enclosed in square brackets
[] . This is the fundamental syntax that defines the start and end of an array in JSON.
The other statements are incorrect based on JSON syntax rules:
- A semicolon separates the key and list of values. This is incorrect. In JSON, a colon separates keys from their values within objects, not arrays. And in arrays, there are no keys, just a list of values.
- The array can include only one value type. This is incorrect. A JSON array can include multiple value types; for example, it can contain strings, numbers, objects, arrays, booleans, and nulls all in the same array.
- A space must separate each value in the array. This is incorrect. While spaces can improve readability, they are not required by JSON syntax. Values can be separated by commas without spaces, and JSON parsers will still be able to read the data correctly.
|