相同信息量的数据,采用不同的形式来表达,用 JSON schema 来描述也是不一样的,表示二的 JSON Schema 如下: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 {"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"birthday":{"type":"string","format"...
JSON数据②(JSON Schema): 代码语言:javascript 代码运行次数:0 运行 AI代码解释 { "type": "object", "properties": { "name": { "type": "string", "minLength": 4 }, "age": { "type": "integer", "minimum": 0, "maximum": 130 }, "gender": { "type": "string", "enum": [ "mal...
json schema是描述你的JSON数据格式;JSON模式(应用程序/模式+ JSON)有多种用途,其中之一就是实例验证。验证过程可以是交互式或非交互式的。例如,应用程序可以使用JSON模式来构建用户界面使互动的内容生成除了用户输入检查或验证各种来源获取的数据。二.基本数据类型 三.关键字 四. 详细使用 json schema是无限递归...
{"allOf":[Schema_base]"properties":{"other_pro1":{"type":"string"},"other_pro2":{"type":"string"}},"required":["other_pro1","other_pro2"]} Json数据既需要满足Schema_base,又要具备属性"other_pro1"、"other_pro2"。 5.2 anyOf 满足anyOf数组中的任意个Schema。 {"anyOf":[Schema1,...
JSON Schema 本身是一段 JSON 格式的数据,如下例所示: { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "age": { ...
"description": "Order event schema for example", "required": ["order_id", "total_price", "products" ], "properties": { "order_id": { "type": "string" }, "event": { "enum": ["PLACED", "DELIVERED", "RETURNED"], "type": "string" ...
JSON Schema 是 JSON 数据的描述语言,它通过指定键值对的规则来定义 JSON 数据的结构和内容。下面是一个简单的 JSON Schema 示例: { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer", "minimum": 0 }, "email": { "type": "string", "forma...
说明是哪个版本的JSON Schema,不同版本间不完全兼容 type string、number、integer、boolean、object等 例如{"type":"integer"}说明该字段一定要是整形 说明字段的类型 pattern { "type": "string", "pattern": "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$"} 正则表达式 enum { "type": "strin...
Json schema 示例 { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "birthday": { "type": "string", "format": "date" }, "address": { "type": "object", ...