json_utils Module

Functions

add_attrib

Add the value of the attribute from the object to the dictionary.

Used to dynamically add the value of the attribute if the value is present.

add_attrib(json_dict: Dict[str, Any], object_, attribute_name: str, alt_name: Optional[str] = None)

Parameters

json_dict
<xref:<xref:The dictionary to add the attribute to>>
Required
object
<xref:<xref:The object to look for the attribute on>>
Required
attribute_name
<xref:<xref:The name of the attribute to look for>>
Required
alt_name
<xref:<xref:An alternate name to provide to the attribute in the in the dictionary>>
default value: None

add_datetime_attrib

Add the value of the attribute from the object to the dictionary converted into a string.

add_datetime_attrib(json_dict: Dict[str, Any], object_, attribute_name: str, alt_name: Optional[str] = None)

Parameters

json_dict
<xref:<xref:The dictionary to add the attribute to>>
Required
object
<xref:<xref:The object to look for the attribute on>>
Required
attribute_name
<xref:<xref:The name of the attribute to look for>>
Required
alt_name
<xref:<xref:An alternate name to provide to the attribute in the in the dictionary>>
default value: None

add_json_attrib

Add the results of the to_json() function call of the attribute from the object to the dict.

Used to dynamically add the JSON converted value of the attribute if the value is present.

add_json_attrib(json_dict: Dict[str, Any], object_, attribute_name: str, alt_name: Optional[str] = None)

Parameters

json_dict
<xref:<xref:The dictionary to add the attribute to>>
Required
object
<xref:<xref:The object to look for the attribute on>>
Required
attribute_name
<xref:<xref:The name of the attribute to look for>>
Required
alt_name
<xref:<xref:An alternate name to provide to the attribute in the in the dictionary>>
default value: None