79666305

Date: 2025-06-15 04:56:47
Score: 1.5
Natty:
Report link

What you describe is called a JSON schema.

For example the JSON schema for the following JSON:

{
        "first" : "Fred",
        "last" : "Flintstone"
}

Would be something like this:

{
  "type": "object",
  "properties": {
    "first": { "type": "string" },
    "last": { "type": "string" },
  }
}

You can then use the jsonschema package for validation:

from jsonschema import validate


validate(
    instance=json_to_validate, schema=json_schema,
)
Reasons:
  • Contains signature (1):
  • Has code block (-0.5):
  • Starts with a question (0.5): What you
  • Low reputation (0.5):
Posted by: scr