ssb_timeseries.io.json_helpers

Provides helper functions for working with JSON data.

sanitize_for_json(d)

Recursively convert custom ssb-timeseries types to JSON-serializable strings.

Return type:

dict[str, typing.Any]

Parameters:

d (dict)

tags_from_json(dict_with_json_string, byte_encoded=True)

Deserialize a tag dictionary from the Parquet metadata format.

This is the reverse of tags_to_json.

Return type:

dict[str, str | list[str]]

Parameters:
  • dict_with_json_string (dict[str | bytes, str | bytes])

  • byte_encoded (bool)

tags_to_json(x)

Serialize a tag dictionary into a format suitable for Parquet metadata.

Return type:

dict[str, bytes]

Parameters:

x (dict[str, str | list[str]])