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

Schema JSON de Produto

Intermediario JSON Schema

Um JSON Schema para validar objetos de produto com campos de preco aninhados e arrays. Um exemplo realista para o seu projeto ou testes.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Product",
  "type": "object",
  "properties": {
    "id": { "type": "string" },
    "name": { "type": "string", "minLength": 1 },
    "price": {
      "type": "object",
      "properties": {
        "amount": { "type": "number", "minimum": 0 },
        "currency": { "type": "string", "pattern": "^[A-Z]{3}$" }
      },
      "required": ["amount", "currency"]
    },
    "tags": {
      "type": "array",
      "items": { "type": "string" },
      "uniqueItems": true
    },
    "inStock": { "type": "boolean" }
  },
  "required": ["id", "name", "price"]
}
Exemplos JSON