herostools.actor.archiver.json_archiver
=======================================

.. py:module:: herostools.actor.archiver.json_archiver


Classes
-------

.. autoapisummary::

   herostools.actor.archiver.json_archiver.JsonArchiver


Module Contents
---------------

.. py:class:: JsonArchiver(save_template: str, merge_metadata: bool = False, *args, **kwargs)

   Bases: :py:obj:`herostools.actor.archiver.base.HERODataArchiver`


   HERODataArchiver that saves dict payloads as ``.json`` files.

   :param object_selector: Zenoh object selector for the devices to subscribe to.
   :param event_name: Name of the event.
   :param save_template: Jinja2 template used to generate the output file path from
                         the payload metadata.
   :param merge_metadata: When ``True``, the metadata dict is embedded in the saved
                          JSON under the key ``metadata``.
   :param default_metadata: Default metadata available to the filename template.
   :param max_retries: Number of times to retry a failed store before dropping the item.


   .. py:attribute:: name_template


   .. py:attribute:: merge_metadata
      :value: False



   .. py:method:: _store(source_name: str, payload: dict, metadata: dict) -> None

      Save the payload as a ``.json`` file.

      :param source_name: Name of the event source (the HERO).
      :param payload: Data to save as a JSON-serialisable dict.
      :param metadata: Incoming metadata merged with ``default_metadata``.



