Skip to main content

PassDict

This class represents a dictionary type for JSON serialization. It checks if a given value is a dictionary and converts it into a JSON object where all values are tagged by the serializer.

Attributes​

AttributeTypeDescription
tagmethodThis attribute is an alias for the 'to_json' method, which is used to convert a dictionary into a JSON-compatible format by serializing its values.

Methods​


check()​

@classmethod
def check(
value: t.Any
) - > bool

Checks if the provided value is a dictionary. This method is used to validate if the input value is of the expected dictionary type.

Parameters​

NameTypeDescription
valuet.AnyThe value to be checked for dictionary type.

Returns​

TypeDescription
boolTrue if the value is a dictionary, False otherwise.

to_json()​

@classmethod
def to_json(
value: t.Any
) - > t.Any

Converts a dictionary into a JSON-compatible format by tagging its values. This method ensures that all values within the dictionary are properly serialized for JSON output.

Parameters​

NameTypeDescription
valuet.AnyThe dictionary to be converted to a JSON-compatible format.

Returns​

TypeDescription
t.AnyA dictionary where each value has been tagged by the serializer, suitable for JSON serialization.