从JSON数据生成JSON模式的工具 [英] Tool to generate JSON schema from JSON data

查看:418
本文介绍了从JSON数据生成JSON模式的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有这个json模式草稿.我想获取我的JSON数据样本,并为JSON模式生成一个框架,该框架可以手动进行修改,添加诸如description,required之类的内容,而这些不能从特定的示例中推断出来.

We have this json schema draft. I would like to get a sample of my JSON data and generate a skeleton for the JSON schema, that I can rework manually, adding things like description, required, etc, which can not be infered from the specific examples.

例如,从我的输入example.json:

{
    "foo": "lorem", 
    "bar": "ipsum"
}

我将运行json_schema_g​​enerator工具,并得到:

I would run my json_schema_generator tool and would get:

{ "foo": {
    "type" : "string",
    "required" : true,
    "description" : "unknown"
  },
  "bar": {
    "type" : "string",
    "required" : true,
    "description" : "unknown"
  }
}

此示例已手动编码,因此可能存在错误. 有没有什么工具可以帮助我进行JSON转换-> JSON模式?

This example has been coded manually, so it has maybe errors. Is there any tool out there which could help me with the conversion JSON -> JSON schema?

推荐答案

看到这个问题越来越多了,我添加了新信息(我不确定这是否是新信息,但是我无法在网上找到它.时间)

Seeing that this question is getting quite some upvotes, I add new information (I am not sure if this is new, but I couldn't find it at the time)

  • The home of JSON Schema
  • An implementation of JSON Schema validation for Python
  • Related hacker news discussion
  • A json schema generator in python, which is what I was looking for.

这篇关于从JSON数据生成JSON模式的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆