Java code for JSON Array ExampleThis Java code snippet was generated automatically for the JSON Array example.
<< Back to the JSON Array example
What is JSON?
JSON Array Examples
JSON arrays come in different types: strings, numbers, booleans, objects, and multidimensional arrays. Below are examples of JSON array types with a detailed description:
JSON Array of Strings
The JSON array of strings contains only string elements, where each element is separated by a comma (,). The following is an example of a JSON array storing string values:
JSON Array of Numbers
The JSON array of numbers contains only numeric elements. Below is an example of a JSON array storing numeric values:
JSON Array of Booleans
The JSON array of booleans contains only booleans (either true or false). The following is an example of an array of JSON booleans:
JSON Array of Objects
JSON Nested Array
JSON arrays can contain various arrays as elements. You can use the "" operator to get an array at any index and use the "" operator again to get an element of the selected array. The following is an example of creating a multidimensional JSON array:
JSON Mixed Array
The mixed JSON array contains various types of elements. Below is an example of a JSON array that stores mixed values: