OSS Nokalva Home Page
>
Resources
>
ASN1.IO
> JSON2ASN
JSON Message
JSON Schema
new
{ "name":"Falcon", "message":"Hello World", "fuel":"liquid", "speed":{ "mph":18000 }, "payload":["Car", "GPS unit"] }
Remember, generating an ASN.1 schema from JSON is always an approximation. Try different options, modify both the JSON and the ASN.1 for the best match. See
examples
.
Naming (non-ASN.1 characters):
Remove
Replace with hyphen
Split and CamelCase
Allow underscores
Underscores are not valid ASN.1 characters, but some ASN.1 compilers allow them.
Arrays (treat arrays as):
List of similar items
Useful for homogeneous arrays.
An ordered list of related items (a tuple)
Useful for arrays of ordered items. Requires an Encoding Instruction.
An unordered collection of various items
Useful for an array of different types. Requires an Encoding Instruction.
Allow the tool to decide
A mix of the above, different arrays may be treated differently.
Treat null and {} as equivalent
Inserting a NULL into an array requires more complex ASN.1.
Values:
Generate ASN.1 values
Include ASN.1 value in the generated schema.
Generate DEFAULTs
Generate default values for primitive types.
Other:
Generate comments/hints
Show how the input JSON message can be changed to better fit ASN.1 schema rules.
Allow ASN.1 Encoding Instructions
Generate an exact, but more complex schema.
Make objects extensible
Add ASN.1 extension marker '...' to SEQUENCE/CHOICE to accommodate for new fields/versioning.
{ "definitions": {}, "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "http://example.com/World-Schema.json", "type": "object", "title": "Rocket", "required": [ "name", "fuel", "payload" ], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 16 }, "message": { "type": "string", "default": "Hello World" }, "fuel": { "type": "string", "enum": ["solid", "liquid", "gas"] }, "speed": { "oneOf":[ { "properties": {"kmph": {"type": "integer"}}, "additionalProperties": false, "required": ["kmph"] }, { "properties": {"mph": {"type": "integer"}}, "additionalProperties": false, "required": ["mph"] } ] }, "payload": { "type": "array", "items": { "type": "string", "examples": [ "Car", "GPS unit" ] } } } }
JSON Schema conversion is in beta. Remember, generating an ASN.1 schema from JSON is always an approximation. Try different options, modify both the JSON and the ASN.1 for the best match. See
examples
.
Naming (non-ASN.1 characters):
Remove
Replace with hyphen
Split and CamelCase
Allow underscores
Underscores are not valid ASN.1 characters, but some ASN.1 compilers allow them.
Other:
Generate comments/hints
Show how the input JSON message can be changed to better fit ASN.1 schema rules.
Allow ASN.1 Encoding Instructions
Generate an exact, but more complex schema.
Force
"additionalProperties":false
, unless specified explicitly
Controls extensibility of strutctured ASN.1 types, which by default are not extendable.
Generate JSONValue for unresolved/unsupported JSON values
Generate a generic ASN.1 type for unsupported and unresolved schema fragments.
ASN.1 Schema
Copy to clipboard