Skip to content

Instantly share code, notes, and snippets.

@lhns
Last active September 16, 2021 11:00
Show Gist options
  • Select an option

  • Save lhns/8c08d42486020a61eecec02adc3ffaa0 to your computer and use it in GitHub Desktop.

Select an option

Save lhns/8c08d42486020a61eecec02adc3ffaa0 to your computer and use it in GitHub Desktop.
JSON Schema for lossless XML to JSON conversion and vice versa
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/node",
"definitions": {
"node": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": [
"string",
"null"
]
},
"attributes": {
"type": [
"object",
"null"
],
"propertyNames": {
"type": "string"
},
"patternProperties": {
"": {
"type": "string"
}
}
},
"children": {
"type": [
"array",
"null"
],
"items": {
"anyOf": [
{
"$ref": "#/definitions/node"
},
{
"type": "string"
}
]
}
}
},
"required": [
"name"
],
"additionalProperties": false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment