Is there any naming convention for a json schema file extension? XML has .xsd (XML Schema Definition), what should json schema files have, .jsd (JSON Schema Definition)?
-
3As someone working on the JSON Schema specification currently, it's not really something that's been considered. If you think it should be, feel free to open an issue on the github repo. – Relequestual Dec 22 '16 at 10:16
6 Answers
From Gary Court:
I personally use .schema.json, but there is no official file extension. The official mime type however is "application/schema+json".

- 8,580
- 9
- 56
- 95

- 16,464
- 4
- 33
- 50
Update 2022Nov
application/schema+json
and application/schema-instance+json
will be published by an IETF RFC.
According to current proposal, both json
and schema.json
extensions are supported. I still find it quite inconvenient for processing based on conventions to have a dot
within an extension.
Previous comment
According to the last draft (v4), there is not a new extension proposed for files storing json-schemas. .json extension is used profusely within that document. .json is also the preferred extension in validators (PHP, Ruby, Python).
So I think that .json should be the preferred option in absence of an official/standard new extension.

- 143,130
- 81
- 406
- 459

- 12,679
- 7
- 55
- 73
-
Would Gary Court's answer work for you? *.schema.json (https://stackoverflow.com/a/10507586/3772517) – michen00 Nov 11 '22 at 05:10
-
Nop. I have updated with current status of things in terms of standardization. – jruizaranguren Nov 11 '22 at 13:03
-
Just a note for those on the fence: json-schema.org uses "schema.json" in the $id of their first example: https://json-schema.org/learn/getting-started-step-by-step.html#starting-the-schema – Design.Garden Jun 08 '23 at 14:03
-
1Thanks, @Design.Garden. The specification for $id says that it must be an URI. https://my/schema/1 would be also correct. I'm aware that usage and social consensus can make all of us select one option. But regarding correctness, .json and any other many.dots.combination.json is a correct way to name json schema files. – jruizaranguren Jun 09 '23 at 05:44
From https://json-schema.org/understanding-json-schema/basics.html#id3
Since JSON Schema is itself JSON, it’s not always easy to tell when something is JSON Schema or just an arbitrary chunk of JSON. The
$schema
keyword is used to declare that something is JSON Schema. It’s generally good practice to include it, though it is not required.
So you can use .json
as the file extension for JSON schema but maybe with a $schema
keyword (although optional) for better distinction.

- 14,222
- 20
- 104
- 125
I've started using .jschema
after I had a run-in with an extension-based JSON Schema parser that automatically added id's to external RAML examples which are also .json
files.
They are a specific format, after all. HTML is XML, which is UML, and we use a different file extension for each of those.

- 1,294
- 2
- 15
- 33
-
13No, HTML is not XML. There are [lots and lots](https://stackoverflow.com/a/39560454/1709587) of differences. – Mark Amery Nov 13 '18 at 13:49
-
3Well, as of HTML5, HTML is a vocabulary defined for two related media types: text/html (which is a complicated parser not based on anything), and application/xhtml+xml (which is standard XML). – awwright Apr 30 '19 at 10:19
-
2
My suggestion is .jsd
or .jsonsd
standing for Json Schema Document
.
I followed the way XML Schemas are named XSD (Xml Schema Document)

- 648
- 9
- 23
A JSON Schema is a valid JSON file so the extension .json is OK.
Then, the first attribute of your file should be '$schema' to declare the version of the specification you are using. Eg.
{
"$schema": "https://json-schema.org/draft/2019-09/schema",

- 11
- 3