Personally I’d pass all my JSON-y stuff through Pydantic or similar which would take care of these concerns.