test/command/suite/load/json/array/nested.test
raw| 1 | #@require-feature simdjson |
| 2 | |
| 3 | table_create Notes TABLE_NO_KEY |
| 4 | column_create Notes data COLUMN_SCALAR JSON |
| 5 | |
| 6 | # Source: |
| 7 | # [ |
| 8 | # true, |
| 9 | # [ |
| 10 | # false, |
| 11 | # null, |
| 12 | # [-1, 1, 2.9], |
| 13 | # ["string"], |
| 14 | # null |
| 15 | # ], |
| 16 | # { |
| 17 | # "string": "world", |
| 18 | # "sub_array": [ |
| 19 | # null, |
| 20 | # { |
| 21 | # "sub_object": false |
| 22 | # }, |
| 23 | # ["sub_string", -2.9] |
| 24 | # ], |
| 25 | # "integer": -29 |
| 26 | # }, |
| 27 | # false |
| 28 | # ] |
| 29 | # JSONify: |
| 30 | # 1. ruby -r json -e 'puts JSON.parse(ARGF.read.gsub(/^#/, "")).to_json.to_json' |
| 31 | # 2. Paste the above source with comment to the stdin of 1. |
| 32 | load --table Notes |
| 33 | [ |
| 34 | {"data": "[true,[false,null,[-1,1,2.9],[\"string\"],null],{\"string\":\"world\",\"sub_array\":[null,{\"sub_object\":false},[\"sub_string\",-2.9]],\"integer\":-29},false]"} |
| 35 | ] |
| 36 | |
| 37 | select Notes |
| 38 | |
| 39 | dump |