Ir al contenido principal
CuteJSON
↑↓ Navegar Enter Seleccionar Esc Cerrar

Esquema JSON de Pedido

Avanzado Esquema JSON

Un esquema de pedido completo con enum de estado, arreglo de articulos y objeto de totales. Listo para copiar y probar.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Order",
  "type": "object",
  "properties": {
    "orderId": { "type": "string", "pattern": "^ORD-[0-9]{5}$" },
    "status": {
      "type": "string",
      "enum": ["pending", "confirmed", "shipped", "delivered", "cancelled"]
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "properties": {
          "productId": { "type": "string" },
          "quantity": { "type": "integer", "minimum": 1 },
          "unitPrice": { "type": "number", "minimum": 0 }
        },
        "required": ["productId", "quantity", "unitPrice"]
      }
    },
    "totals": {
      "type": "object",
      "properties": {
        "subtotal": { "type": "number" },
        "tax": { "type": "number" },
        "shipping": { "type": "number" },
        "grandTotal": { "type": "number" }
      }
    }
  },
  "required": ["orderId", "status", "items"]
}
Ejemplos JSON