Codec¶
-
class
ydk.path.
Codec
¶ YDK Path Codec provides encode and decode translations between string payload and
DataNode
.-
encode(data_node, encoding, pretty=True):
Encodes data in data_node to string payload.
Parameters: - data_node –
(
DataNode
) for single data node to encode.For multiple data nodes encapsulate
DataNode
instances into Pythonlist
. - encoding – (
EncodingFormat
) Encoding format. - pretty – (
bool
) Pretty format.
Returns: (
str
) encoded payload.Raises: RuntimeError
withYCodecError
prefix, if an error has occurred.- data_node –
-
decode(root_schema_node, payload, encoding):
Decodes payload string into
DataNode
instance.Parameters: - root_schema_node – (
RootSchemaNode
) An instance of root_schema_node. - payload – (
str
) Payload to decode. - encoding – (
EncodingFormat
) Encoding format.
Returns: (
DataNode
) instance of a data-node.Raises: RuntimeError
withYCodecError
prefix, if an error has occurred.- root_schema_node – (
-