跳转到主要内容

从jsonschema创建StrictYAML模式

项目描述

StrictYAMLJSONSchema

将JSON模式转换为StrictYAML模式。

简单示例

{
    "type": "object",
    "properties": {
        "age": {
            "type": "integer"
        },
        "name": {
            "type": "string"
        },
        "possessions": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    },
    "required": ["age", "name", "possession"]
}
# All about the character
name: Ford Prefect
age: 42
possessions:
- Towel
from strictyamljsonschema import load_schema
from strictyaml import load
import json

正确解析

print(load(yaml_snippet, load_schema(json.loads(json_schema))).data)
OrderedDict([('name', 'Ford Prefect'), ('age', 42), ('possessions', ['Towel'])])

安装

$ pip install strictyamljsonschema

项目详情


下载文件

下载适合您平台的文件。如果您不确定要选择哪一个,请了解更多关于 安装包 的信息。

源分布

strictyamljsonschema-0.1.0.tar.gz (3.2 kB 查看哈希值)

上传时间

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面