Quellcode für text_lint.operations.lookups.encoders.lower
"""LowerCaseEncoder class."""
import json
from typing import Any
[Doku]
class LowerCaseEncoder(json.JSONEncoder):
"""JSON encoder that converts strings to lower case."""
[Doku]
def encode(self, o: Any) -> Any:
"""Encode as JSON while converting all strings values to lower case.
:param o: The object being converted.
:returns: The converted object.
"""
value = super().encode(o)
if isinstance(value, str):
return value.lower()
return value