Vai al contenuto principale
CuteJSON
↑↓ Naviga Enter Seleziona Esc Chiudi

Schema JSON utente

Intermedio JSON Schema

Un JSON Schema per validare oggetti utente con campi obbligatori, pattern e enum. Un esempio realistico per il tuo progetto o i tuoi test.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/user.schema.json",
  "title": "User",
  "description": "A user account in the system.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^usr_[a-z0-9]{6}$",
      "description": "Unique user identifier"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "integer",
      "minimum": 0,
      "maximum": 150
    },
    "role": {
      "type": "string",
      "enum": ["admin", "editor", "viewer"]
    }
  },
  "required": ["id", "name", "email"],
  "additionalProperties": false
}
Esempi JSON