bach.SeriesJson.json

property json​

: bach.series.series_json.JsonAccessor

Get access to json operations via the class that’s returned through this accessor. Use as my_series.json.get_value() or my_series.json[:2]

class JsonAccessor​

(series_object)

Class with accessor methods to JSON type data.

array_contains​

(item)

Find if item is contained in the array.

Parameters​

item – item to be verified if it is contained by the array. Only supports scalar values.

Returns​

boolean series indicating if the array contains the element.

This assumes the top-level item in the json is an array.

flatten_array​

()

Converts elements in an array into a set of rows.

Since the operation might destroy the order of the elements, a series containing the offset is also returned.

Returns​

Tuple with SeriesJson (element from the array) and SeriesInt64 (0-based offset of the element)

note

Both returned series objects will share same base node, but this node is not the same as the unflatten Series.

This assumes the top-level item in the json is an array.

get_array_length​

()

Get the length of the toplevel array.

This assumes the top-level item in the json is an array. Will result in an exception (later on) if that’s not the case!

get_value​

(key, as_str=False)

Get item from toplevel object by key.

Parameters​

  • key – the key to return the values for.
  • as_str – if True, it returns a string Series, json otherwise. Particular useful if the returned value is in fact a string. In json the string will be represented as a quoted string, if this field is set to true, the returned SeriesString will not have additional quotes.

Returns​

series with the selected object value.