Pular para o conteudo principal
CuteJSON
↑↓ Navegar Enter Selecionar Esc Fechar

Schema JSON de Usuario

Intermediario JSON Schema

Um JSON Schema para validar objetos de usuario com campos obrigatorios, padroes e enums. Um exemplo realista para o seu projeto ou testes.

{
  "$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
}
Exemplos JSON