1# basic_json::array 2 3```cpp 4static basic_json array(initializer_list_t init = {}); 5``` 6 7Creates a JSON array value from a given initializer list. That is, given a list of values `a, b, c`, creates the JSON 8value `#!json [a, b, c]`. If the initializer list is empty, the empty array `#!json []` is created. 9 10## Parameters 11 12`init` (in) 13: initializer list with JSON values to create an array from (optional) 14 15## Return value 16 17JSON array value 18 19## Exception safety 20 21Strong guarantee: if an exception is thrown, there are no changes in the JSON value. 22 23## Complexity 24 25Linear in the size of `init`. 26 27## Notes 28 29This function is only needed to express two edge cases that cannot be realized with the initializer list constructor 30([`basic_json(initializer_list_t, bool, value_t)`](basic_json.md)). These cases are: 31 321. creating an array whose elements are all pairs whose first element is a string -- in this case, the initializer list 33 constructor would create an object, taking the first elements as keys 342. creating an empty array -- passing the empty initializer list to the initializer list constructor yields an empty 35 object 36 37## Examples 38 39??? example 40 41 The following code shows an example for the `array` function. 42 43 ```cpp 44 --8<-- "examples/array.cpp" 45 ``` 46 47 Output: 48 49 ```json 50 --8<-- "examples/array.output" 51 ``` 52 53## Version history 54 55- Added in version 1.0.0. 56