diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2023-10-28 19:18:58 -0600 |
---|---|---|
committer | David Faure <faure@kde.org> | 2023-10-29 07:56:34 +0000 |
commit | bff5bec3dadc3332f6ba336243611b297082cbda (patch) | |
tree | 80066650712f92e59e86ea1d899e7772db9b457c | |
parent | c461f247a61f497ff96cd22b84527346d154f5e3 (diff) |
Add application/json5
JSON5 is a superset of standard JSON that permits comments and trailing
commas. Although application/json5 is not an official IANA media type,
it is used by Nim, Fastify, Altova, and others.
https://nim-lang.org/1.6.6/mimetypes.html
https://www.jsdelivr.com/package/npm/fastify-json5
https://www.altova.com/manual/Mapforce/mapforceenterprise/mff_json5.html
-rw-r--r-- | data/freedesktop.org.xml.in | 10 | ||||
-rw-r--r-- | tests/mime-detection/json_array.json5 | 23 | ||||
-rw-r--r-- | tests/mime-detection/list | 2 |
3 files changed, 34 insertions, 1 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in index 01e6ab4..ede782f 100644 --- a/data/freedesktop.org.xml.in +++ b/data/freedesktop.org.xml.in @@ -2709,10 +2709,18 @@ command to generate the output files. <comment>JSON document</comment> <acronym>JSON</acronym> <expanded-acronym>JavaScript Object Notation</expanded-acronym> - <sub-class-of type="text/javascript"/> + <sub-class-of type="application/json5"/> <generic-icon name="text-x-script"/> <glob pattern="*.json"/> </mime-type> + <mime-type type="application/json5"> + <comment>JSON5 document</comment> + <acronym>JSON5</acronym> + <expanded-acronym>JavaScript Object Notation 5</expanded-acronym> + <sub-class-of type="text/javascript"/> + <generic-icon name="text-x-script"/> + <glob pattern="*.json5"/> + </mime-type> <mime-type type="application/jrd+json"> <comment>JRD document</comment> <acronym>JRD</acronym> diff --git a/tests/mime-detection/json_array.json5 b/tests/mime-detection/json_array.json5 new file mode 100644 index 0000000..b871072 --- /dev/null +++ b/tests/mime-detection/json_array.json5 @@ -0,0 +1,23 @@ +[ + // JSON5 can have comments and trailing commas + /*{ + "precision": "zip", + "Latitude": 37.7668, + "Longitude": -122.3959, + "Address": "", + "City": "SAN FRANCISCO", + "State": "CA", + "Zip": "94107", + "Country": "US" + },*/ + { + "precision": "zip", + "Latitude": 37.371991, + "Longitude": -122.026020, + "Address": "", + "City": "SUNNYVALE", + "State": "CA", + "Zip": "94085", + "Country": "US", + }, +] diff --git a/tests/mime-detection/list b/tests/mime-detection/list index 2697364..cc4f0de 100644 --- a/tests/mime-detection/list +++ b/tests/mime-detection/list @@ -321,6 +321,8 @@ javascript-without-extension text/javascript xoo # The following two copied from RFC 4627. json_object.json application/json ox json_array.json application/json ox +# Copy of json_array.json with comments and trailing commas +json_array.json5 application/json5 ox # Copied from RFC 7033 webfinger.jrd application/jrd+json ox # Copied from RFC 6902 |