{"id":4625,"library":"marshmallow-jsonschema","title":"marshmallow-jsonschema: JSON Schema Generation from Marshmallow Schemas","description":"marshmallow-jsonschema translates marshmallow schemas into JSON Schema Draft v7 compliant jsonschema. It enables developers to generate JSON Schemas directly from their existing Marshmallow schemas, which is particularly useful for frontend form generation, API documentation, or validation in other systems. The current version is 0.13.0, released in October 2021, suggesting a maintenance rather than a rapid release cadence.","status":"maintenance","version":"0.13.0","language":"en","source_language":"en","source_url":"https://github.com/fuhrysteve/marshmallow-jsonschema","tags":["marshmallow","json-schema","serialization","validation","schema-generation","api-docs"],"install":[{"cmd":"pip install marshmallow-jsonschema","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for defining schemas to be converted.","package":"marshmallow"}],"imports":[{"symbol":"JSONSchema","correct":"from marshmallow_jsonschema import JSONSchema"}],"quickstart":{"code":"from marshmallow import Schema, fields\nfrom marshmallow_jsonschema import JSONSchema\n\nclass UserSchema(Schema):\n    username = fields.String(required=True, metadata={'description': 'The user\\'s unique identifier'})\n    age = fields.Integer(required=False, allow_none=True, metadata={'minimum': 0})\n    email = fields.Email(required=True)\n\n# Instantiate the JSONSchema converter\njson_schema_converter = JSONSchema()\n\n# Convert your Marshmallow schema to a JSON Schema dictionary\nuser_json_schema = json_schema_converter.dump(UserSchema())\n\nimport json\nprint(json.dumps(user_json_schema, indent=2))","lang":"python","description":"This quickstart demonstrates how to define a basic Marshmallow schema and then use `marshmallow-jsonschema` to convert it into a JSON Schema representation. The output is a standard JSON Schema dictionary, ready for use in other applications."},"warnings":[{"fix":"Avoid using `marshmallow.fields.Enum` or consider using the `marshmallow-jsonschema-3` fork which addresses this and other OpenAPI/JSON Schema 3.x features. Alternatively, implement custom field handling for enums.","message":"`marshmallow-jsonschema` is not compatible with `marshmallow.fields.Enum` introduced in Marshmallow v3.18.0. Using this field type will result in an `UnsupportedValueError`.","severity":"breaking","affected_versions":"marshmallow-jsonschema < 0.14.0 with marshmallow >= 3.18.0"},{"fix":"These are warnings from Marshmallow itself, not `marshmallow-jsonschema`. While the library might still function, upgrading `marshmallow-jsonschema` to a version that properly supports Marshmallow 4.x is the long-term solution. For now, ensure your Marshmallow schemas follow the latest best practices for field definition.","message":"When used with newer Marshmallow versions (e.g., v4.x), `marshmallow-jsonschema` may produce `RemovedInMarshmallow4Warning` warnings related to deprecated field attributes like `default` (use `dump_default`) and passing field `metadata` as keyword arguments (use explicit `metadata=` argument).","severity":"deprecated","affected_versions":"marshmallow-jsonschema < 0.14.0 with marshmallow >= 4.0.0"},{"fix":"If you need to generate Marshmallow schemas from JSON Schema, you will need to use a different tool or implement a custom solution. This library is strictly a one-way conversion tool.","message":"`marshmallow-jsonschema` only supports converting Marshmallow schemas *to* JSON Schema. There is no built-in functionality to generate a Marshmallow schema *from* an existing JSON Schema.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}