pyarrow.json_#

pyarrow.json_(DataType storage_type=utf8())#

Create instance of JSON extension type.

Parameters:
storage_typeDataType, default pyarrow.string()

The underlying data type. Can be on of the following types: string, large_string, string_view.

Returns:
typeJsonType

Examples

Create an instance of JSON extension type:

>>> import pyarrow as pa
>>> pa.json_(pa.utf8())
JsonType(extension<arrow.json>)

Use the JSON type to create an array:

>>> pa.array(['{"a": 1}', '{"b": 2}'], type=pa.json_(pa.utf8()))
<pyarrow.lib.JsonArray object at ...>
[
  "{"a": 1}",
  "{"b": 2}"
]