ak.from_json — Awkward Array documentation

# ak.from_json

Defined in awkward.operations.convert on line 1022.

ak.from_json(source, nan_string=None, infinity_string=None, minus_infinity_string=None, complex_record_fields=None, highlevel=True, behavior=None, initial=1024, resize=1.5, buffersize=65536)
  Parameters:

    - source (str) – JSON-formatted string or filename to convert into an array.

    - nan_string (None or str) – If not None, strings with this value will be interpreted as floating-point NaN values.

    - infinity_string (None or str) – If not None, strings with this value will be interpreted as floating-point positive infinity values.

    - minus_infinity_string (None or str) – If not None, strings with this value will be interpreted as floating-point negative infinity values.

    - complex_record_fields (None or (str, str)) – If not None, defines a pair of field names to interpret records as complex numbers.

    - highlevel (bool) – If True, return an `ak.Array`; otherwise, return a low-level `ak.layout.Content` subclass.

    - behavior (None or dict) – Custom `ak.behavior` for the output array, if high-level.

    - initial (int) – Initial size (in bytes) of buffers used by `ak.layout.ArrayBuilder` (see `ak.layout.ArrayBuilderOptions`).

    - resize (float) – Resize multiplier for buffers used by `ak.layout.ArrayBuilder` (see `ak.layout.ArrayBuilderOptions`); should be strictly greater than 1.

    - buffersize (int) – Size (in bytes) of the buffer used by the JSON parser.

Converts a JSON string into an Awkward Array.

Internally, this function uses `ak.layout.ArrayBuilder` (see the high-level `ak.ArrayBuilder` documentation for a more complete description), so it has the same flexibility and the same constraints. Any heterogeneous and deeply nested JSON can be converted, but the output will never have regular-typed array lengths.

See also `ak.to_json`.