6

XML has a convention whereby non-standard mime types based on XML take on a '+xml' suffix (useful for syntax-highlighting, etc). This is outlined by RFC3023.

I've taken a look at RFC4626 but I can't find any mention of something similar for JSON. Does JSON have a similar convention? Is it documented anywhere?

Community
  • 1
  • 1
Gili
  • 86,244
  • 97
  • 390
  • 689

5 Answers5

3

Yes the +json suffix is described in the following RFC: https://www.rfc-editor.org/rfc/rfc6839

Community
  • 1
  • 1
Steffen
  • 46
  • 1
  • 3
    Maybe you could expand your answer, at the moment it amounts to little more than a link. – Kev Mar 11 '13 at 19:20
2

XML has a variety of media types out there. Some common ones are:

  • XHTML (extensible hypertext markup language) application/xhtml+xml
  • SVG (scalable vector graphics) image/svg+xml
  • RSS (really simple syndication) application/rss+xml

Each MIME type identifies a different language.

RFC 3023 standardizes the convention of using the suffix +xml as rightly pointed out by you.

Paraphrased from the wikipedia article - XML and MIME.

Update: Removed incorrect assumption that JSON is not used as an alternative representation for XML.

There are alternate MIME types with suffix +json being widely used. And as rightly pointed out these will continue grow considering JSON.

The +json suffix convention is non-standard, but being used by others.

Community
  • 1
  • 1
Ocaj Nires
  • 3,295
  • 1
  • 18
  • 10
  • 2
    I don't think this is true -- there is growing number of formats based on JSON, similar to how XML (meta-language) is used to define things like XHTML, SVG and RSS. For example, activity streams format has both XML and JSON base variants; geoJSON is used quite widely, and number will grow. – StaxMan Aug 09 '11 at 17:38
2

There is an ongoing specification process for "application/" subtype "+json" in A JSON Media Type for Describing the Structure and Meaning of JSON Documents in draft status writing this. Further resources are available at http://json-schema.org/.

Community
  • 1
  • 1
Raphael Bossek
  • 1,904
  • 14
  • 25
  • The JSON Schema specification does not actually define a `+json` suffix contention. The specification just happens to refer to a `application/schema+json` mime type but that isn't the same. – Gili Sep 02 '11 at 15:52
  • Wow. I have no idea what I was thinking. You're right, the attached draft *does* define a `+json` suffix. – Gili Nov 09 '12 at 19:51
1

The GitHub API uses custom JSON mime types.

http://developer.github.com/v3/media/

You could adopt their conventions.

I don't think it's been documented in the same way as custom XML mime types have. I think it's useful, though, and that it ought to be documented. In the meantime you can use them, and understand that some tools won't recognize the mime type as JSON.

womble
  • 12,033
  • 5
  • 52
  • 66
Benjamin Atkin
  • 14,071
  • 7
  • 61
  • 60
0

I have seen such convention being used, yes. This is not something JSON (the specification) has to specify, although maybe later revisions could suggest guidelines. Most likely it would be defined as a separate RFC.

You might want to ask this question on a mailing list such as restful-json, where there are more experts who could give more complete answer.

StaxMan
  • 113,358
  • 34
  • 211
  • 239