小编Nit*_*inK的帖子

元组数组的JSON模式

提前致谢.

我是JSON和JSON架构的新手.试图为元组数组生成JSON模式.但它没有验证多个记录,如所有类似类型的元组的循环.下面是json样本.

{
  "Data":
   [
      [ 100, "Test", 2.5 ],
      [ 101, "Test1", 3.5]
   ]
}
Run Code Online (Sandbox Code Playgroud)

我使用网站jsonschema.net生成了模式,如下所示

{

  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "object",
  "properties": {
    "Data": {
      "id": "http://jsonschema.net/Data",
      "type": "array",
      "items": [
        {
          "id": "http://jsonschema.net/Data/0",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/Data/0/0",
              "type": "integer"
            },
            {
              "id": "http://jsonschema.net/Data/0/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/Data/0/2",
              "type": "number"
            }
          ],
          "required": [
            "0",
            "1",
            "2"
          ]
        },
        {
          "id": "http://jsonschema.net/Data/1",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/Data/1/0",
              "type": …
Run Code Online (Sandbox Code Playgroud)

javascript json json.net jsonschema

3
推荐指数
2
解决办法
3087
查看次数

标签 统计

javascript ×1

json ×1

json.net ×1

jsonschema ×1