4

I have definitions of many JSON objects. They include optional elements and several different types. Also some of the definitions are interconnected. e.g.: if you have a definition of how 'address' could look like, one element of the 'user' definition could be 'address'.

What python library do you use in order to write JSON schemas that help generate generic JSON objects and is also able to validate.

It would especially be nice if I could generate a minimum JSON (only the required elements), a full JSON (all required and optional elements) or even specify the the number of elements generated for lists.

1
  • Although I implemented something that fits my needs for now, feel free to try to answer with existing libraries or other suggestions, regardless of how outdated the question will become ;) Commented Jul 11, 2012 at 12:42

1 Answer 1

1

Dictshield looks good to me.

Source at https://github.com/j2labs/dictshield

Sign up to request clarification or add additional context in comments.

3 Comments

Is good for validating, but I would love the functionality of generating generic examples for a class.
SchemaObj.to_jsonschema() if that is what you mean
I don't want a schema, but a generic example of how the json could look like. Random values for all required fields according to their type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.