salt.serializers

salt.utils.serializers

This module implements all the serializers needed by salt. Each serializer offers the same functions and attributes:

deserialize:function for deserializing string or stream
serialize:function for serializing a Python object
available:flag that tells if the serializer is available (all dependencies are met etc.)

salt.utils.serializers.json

Implements JSON serializer.

It's just a wrapper around json (or simplejson if available).

salt.utils.serializers.json.deserialize(stream_or_string, **options)

Deserialize any string of stream like object into a Python data structure.

Parameters:
  • stream_or_string -- stream or string to deserialize.
  • options -- options given to lower json/simplejson module.
salt.utils.serializers.json.serialize(obj, **options)

Serialize Python data to JSON.

Parameters:
  • obj -- the data structure to serialize
  • options -- options given to lower json/simplejson module.

salt.utils.serializers.yaml

Implements YAML serializer.

Underneath, it is based on pyyaml and use the safe dumper and loader. It also use C bindings if they are available.

salt.utils.serializers.yaml.deserialize(stream_or_string, **options)

Deserialize any string of stream like object into a Python data structure.

Parameters:
  • stream_or_string -- stream or string to deserialize.
  • options -- options given to lower yaml module.
salt.utils.serializers.yaml.serialize(obj, **options)

Serialize Python data to YAML.

Parameters:
  • obj -- the data structure to serialize
  • options -- options given to lower yaml module.

salt.utils.serializers.msgpack

Implements MsgPack serializer.

salt.utils.serializers.msgpack.deserialize(stream_or_string, **options)

Deserialize any string of stream like object into a Python data structure.

Parameters:
  • stream_or_string -- stream or string to deserialize.
  • options -- options given to lower msgpack module.
salt.utils.serializers.msgpack.serialize(obj, **options)

Serialize Python data to MsgPack.

Parameters:
  • obj -- the data structure to serialize
  • options -- options given to lower msgpack module.