Object Data Type
This feature is not production-ready and deprecated. If you need to work with JSON documents, consider using this guide instead. A new implementation to support JSON object is in Beta. Further details here.
Stores JavaScript Object Notation (JSON) documents in a single column.
JSON
can be used as an alias to Object('json')
when setting use_json_alias_for_old_object_type is enabled.
Example
Example 1
Creating a table with a JSON
column and inserting data into it:
Example 2
To be able to create an ordered MergeTree
family table, the sorting key has to be extracted into its column. For example, to insert a file of compressed HTTP access logs in JSON format:
Displaying JSON columns
When displaying a JSON
column, ClickHouse only shows the field values by default (because internally, it is represented as a tuple). You can also display the field names by setting output_format_json_named_tuples_as_objects = 1
: