pashehnet.sensors.formats.json#

Module Contents#

Classes#

JSONFormat

Formatter class that takes a templated JSON-compatible dict + a JSONPath selector spec for the value, and returns properly formatted JSON for any provided value. See also: - https://pypi.org/project/jsonpath-ng/

API#

class pashehnet.sensors.formats.json.JSONFormat(tpl, value_path)#

Bases: pashehnet.sensors.formats.base.SensorFormatBase

Formatter class that takes a templated JSON-compatible dict + a JSONPath selector spec for the value, and returns properly formatted JSON for any provided value. See also: - https://pypi.org/project/jsonpath-ng/

Initialization

Constructor for class

Parameters:
  • tpl – Template dict for JSON data

  • value_path – JSONPath selector for value location

__slots__ = ()#
transform(value)#

Apply formatter transform to value

Parameters:

value – Value to inject into JSON template

Returns:

JSON string