Loading ...
Sorry, an error occurred while loading the content.

Media type for JSON?

Expand Messages
  • Robert Cerny
    I want to build a web application where the responses to requests will be in JSON or at some point in time in a different format (e.g. XML). HTTP does allow
    Message 1 of 13 , Jul 26, 2005
    View Source
    • 0 Attachment
      I want to build a web application where the responses to requests will
      be in JSON or at some point in time in a different format (e.g. XML).
      HTTP does allow the client to state a preference for a certain
      representation of a resource by sending the header field "Accept". The
      value of the field is a media range which can be as narrow as one
      media type (e.g. "text/html"). I think using "Accept" to state the
      client's wish for a JSON representation of the resource would be
      appropriate. Does anyone disagree?

      Further, what is the media type of JSON? Is there already a standard
      mime type for JSON? If not, how do we get one and what should it be?

      Robert.
    • Roland H. Alden
      It would seem text/json is what it should be and I believe there is a documented registration process at IANA.
      Message 2 of 13 , Jul 26, 2005
      View Source
      • 0 Attachment
        It would seem text/json is what it should be and I believe there is a
        documented registration process at IANA.


        > -----Original Message-----
        > From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
        > Robert Cerny
        > Sent: Tuesday, July 26, 2005 1:56 AM
        > To: json@yahoogroups.com
        > Subject: [json] Media type for JSON?
        >
        > I want to build a web application where the responses to requests will
        > be in JSON or at some point in time in a different format (e.g. XML).
        > HTTP does allow the client to state a preference for a certain
        > representation of a resource by sending the header field "Accept". The
        > value of the field is a media range which can be as narrow as one
        > media type (e.g. "text/html"). I think using "Accept" to state the
        > client's wish for a JSON representation of the resource would be
        > appropriate. Does anyone disagree?
        >
        > Further, what is the media type of JSON? Is there already a standard
        > mime type for JSON? If not, how do we get one and what should it be?
        >
        > Robert.
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
      • Martin Cooper
        ... No, I don t think so. Note that text/javascript and text/ecmascript are obsolete, and replaced by application/javascript and application/ecmascript
        Message 3 of 13 , Jul 26, 2005
        View Source
        • 0 Attachment
          On 7/26/05, Roland H. Alden <ralden@...> wrote:
          > It would seem text/json is what it should be and I believe there is a
          > documented registration process at IANA.

          No, I don't think so. Note that text/javascript and text/ecmascript
          are obsolete, and replaced by application/javascript and
          application/ecmascript respectively. See:

          https://datatracker.ietf.org/public/idindex.cgi?command=id_detail&filename=draft-hoehrmann-script-types

          Therefore, any media type registered for JSON would likely be application/json.

          --
          Martin Cooper


          > > -----Original Message-----
          > > From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
          > > Robert Cerny
          > > Sent: Tuesday, July 26, 2005 1:56 AM
          > > To: json@yahoogroups.com
          > > Subject: [json] Media type for JSON?
          > >
          > > I want to build a web application where the responses to requests will
          > > be in JSON or at some point in time in a different format (e.g. XML).
          > > HTTP does allow the client to state a preference for a certain
          > > representation of a resource by sending the header field "Accept". The
          > > value of the field is a media range which can be as narrow as one
          > > media type (e.g. "text/html"). I think using "Accept" to state the
          > > client's wish for a JSON representation of the resource would be
          > > appropriate. Does anyone disagree?
          > >
          > > Further, what is the media type of JSON? Is there already a standard
          > > mime type for JSON? If not, how do we get one and what should it be?
          > >
          > > Robert.
          > >
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • Roland H. Alden
          ... You would seem to be correct assuming RFC 2046 is the controlling standard. Quoting from that: 4.5. Application Media Type The application media type is
          Message 4 of 13 , Jul 26, 2005
          View Source
          • 0 Attachment
            > Therefore, any media type registered for JSON would likely be
            > application/json.

            You would seem to be correct assuming RFC 2046 is the controlling
            standard. Quoting from that:

            4.5. Application Media Type

            The "application" media type is to be used for discrete data which do
            not fit in any of the other categories, and particularly for data to
            be processed by some type of application program. This is
            information which must be processed by an application before it is
            viewable or usable by a user. Expected uses for the "application"
            media type include file transfer, spreadsheets, data for mail-based
            scheduling systems, and languages for "active" (computational)
            material. (The latter, in particular, can pose security problems
            which must be understood by implementors, and are considered in
            detail in the discussion of the "application/PostScript" media type.)
          • Mark Miller
            ... What are the media types for html and xml? -- Text by me above is hereby placed in the public domain Cheers, --MarkM
            Message 5 of 13 , Jul 26, 2005
            View Source
            • 0 Attachment
              Roland H. Alden wrote:
              >>Therefore, any media type registered for JSON would likely be
              >>application/json.
              >
              >
              > You would seem to be correct assuming RFC 2046 is the controlling
              > standard. Quoting from that:
              >
              > 4.5. Application Media Type
              >
              > The "application" media type is to be used for discrete data which do
              > not fit in any of the other categories, and particularly for data to
              > be processed by some type of application program. This is
              > information which must be processed by an application before it is
              > viewable or usable by a user.


              What are the media types for html and xml?


              --
              Text by me above is hereby placed in the public domain

              Cheers,
              --MarkM
            • Martin Cooper
              ... Those are text/html and text/xml, respectively. See: http://www.iana.org/assignments/media-types/ -- Martin Cooper
              Message 6 of 13 , Jul 26, 2005
              View Source
              • 0 Attachment
                On 7/26/05, Mark Miller <markm@...> wrote:
                > Roland H. Alden wrote:
                > >>Therefore, any media type registered for JSON would likely be
                > >>application/json.
                > >
                > >
                > > You would seem to be correct assuming RFC 2046 is the controlling
                > > standard. Quoting from that:
                > >
                > > 4.5. Application Media Type
                > >
                > > The "application" media type is to be used for discrete data which do
                > > not fit in any of the other categories, and particularly for data to
                > > be processed by some type of application program. This is
                > > information which must be processed by an application before it is
                > > viewable or usable by a user.
                >
                >
                > What are the media types for html and xml?

                Those are text/html and text/xml, respectively. See:

                http://www.iana.org/assignments/media-types/

                --
                Martin Cooper


                > --
                > Text by me above is hereby placed in the public domain
                >
                > Cheers,
                > --MarkM
                >
                >
                >
                >
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
                >
                >
              • Mark Miller
                ... JSON is more like html & xml than it is like javascript. Therefore, reasoning by precedent and analogy, I think the right answer is text/json. -- Text by
                Message 7 of 13 , Jul 26, 2005
                View Source
                • 0 Attachment
                  Martin Cooper wrote:
                  > On 7/26/05, Mark Miller <markm@...> wrote:
                  >
                  >>Roland H. Alden wrote:
                  >>
                  >>>>Therefore, any media type registered for JSON would likely be
                  >>>>application/json.
                  >>>
                  >>>
                  >>>You would seem to be correct assuming RFC 2046 is the controlling
                  >>>standard. Quoting from that:
                  >>>
                  >>>4.5. Application Media Type
                  >>>
                  >>> The "application" media type is to be used for discrete data which do
                  >>> not fit in any of the other categories, and particularly for data to
                  >>> be processed by some type of application program. This is
                  >>> information which must be processed by an application before it is
                  >>> viewable or usable by a user.
                  >>
                  >>
                  >>What are the media types for html and xml?
                  >
                  >
                  > Those are text/html and text/xml, respectively. See:
                  >
                  > http://www.iana.org/assignments/media-types/


                  JSON is more like html & xml than it is like javascript. Therefore, reasoning
                  by precedent and analogy, I think the right answer is text/json.


                  --
                  Text by me above is hereby placed in the public domain

                  Cheers,
                  --MarkM
                • Martin Cooper
                  ... I disagree that JSON is more like HTML and XML than like JavaScript, particularly when it s specifically a subset of JavaScript. Further, to quote some
                  Message 8 of 13 , Jul 26, 2005
                  View Source
                  • 0 Attachment
                    On 7/26/05, Mark Miller <markm@...> wrote:
                    > Martin Cooper wrote:
                    > > On 7/26/05, Mark Miller <markm@...> wrote:
                    > >
                    > >>Roland H. Alden wrote:
                    > >>
                    > >>>>Therefore, any media type registered for JSON would likely be
                    > >>>>application/json.
                    > >>>
                    > >>>
                    > >>>You would seem to be correct assuming RFC 2046 is the controlling
                    > >>>standard. Quoting from that:
                    > >>>
                    > >>>4.5. Application Media Type
                    > >>>
                    > >>> The "application" media type is to be used for discrete data which do
                    > >>> not fit in any of the other categories, and particularly for data to
                    > >>> be processed by some type of application program. This is
                    > >>> information which must be processed by an application before it is
                    > >>> viewable or usable by a user.
                    > >>
                    > >>
                    > >>What are the media types for html and xml?
                    > >
                    > >
                    > > Those are text/html and text/xml, respectively. See:
                    > >
                    > > http://www.iana.org/assignments/media-types/
                    >
                    >
                    > JSON is more like html & xml than it is like javascript. Therefore, reasoning
                    > by precedent and analogy, I think the right answer is text/json.

                    I disagree that JSON is more like HTML and XML than like JavaScript,
                    particularly when it's specifically a subset of JavaScript.

                    Further, to quote some fragments from RFC 2046:

                    (From section 4.1)
                    The "text" media type is intended for sending material which is
                    principally textual in form.
                    [...]
                    Beyond plain text, there are many formats for representing what might
                    be known as "rich text". An interesting characteristic of many such
                    representations is that they are to some extent readable even without
                    the software that interprets them. It is useful, then, to
                    distinguish them, at the highest level, from such unreadable data as
                    images, audio, or text represented in an unreadable form. In the
                    absence of appropriate interpretation software, it is reasonable to
                    show subtypes of "text" to the user, while it is not reasonable to do
                    so with most nontextual data. Such formatted textual data should be
                    represented using subtypes of "text".

                    I think it would be pretty hard to argue that JSON is "rich text", or
                    that it would be reasonable to show JSON code directly to the user.

                    (From section 4.5)
                    The "application" media type is to be used for discrete data which do
                    not fit in any of the other categories, and particularly for data to
                    be processed by some type of application program. This is
                    information which must be processed by an application before it is
                    viewable or usable by a user. Expected uses for the "application"
                    media type include file transfer, spreadsheets, data for mail-based
                    scheduling systems, and languages for "active" (computational)
                    material. (The latter, in particular, can pose security problems
                    which must be understood by implementors, and are considered in
                    detail in the discussion of the "application/PostScript" media type.)

                    IMO, this explains rather well the usage of JSON. It certainly seems
                    much more appropriate to me than a "text" media type.

                    --
                    Martin Cooper


                    > --
                    > Text by me above is hereby placed in the public domain
                    >
                    > Cheers,
                    > --MarkM
                    >
                    >
                    >
                    >
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                  • Mark Miller
                    ... By what stretch of the imagination is xml readable? -- Text by me above is hereby placed in the public domain Cheers, --MarkM
                    Message 9 of 13 , Jul 26, 2005
                    View Source
                    • 0 Attachment
                      Martin Cooper wrote:
                      >
                      > (From section 4.1)
                      > The "text" media type is intended for sending material which is
                      > principally textual in form.
                      > [...]
                      > Beyond plain text, there are many formats for representing what might
                      > be known as "rich text". An interesting characteristic of many such
                      > representations is that they are to some extent *readable* even without
                      > the software that interprets them. [Emphasis added]
                      >
                      > I think it would be pretty hard to argue that JSON is "rich text", or
                      > that it would be reasonable to show JSON code directly to the user.

                      By what stretch of the imagination is xml readable?

                      --
                      Text by me above is hereby placed in the public domain

                      Cheers,
                      --MarkM
                    • Douglas Crockford
                      ... I agree with MarkM on this one. JSON is not JavaScript. While it is a subset of JavaScript, its usage patterns are radically different. I think the right
                      Message 10 of 13 , Jul 29, 2005
                      View Source
                      • 0 Attachment
                        > > JSON is more like html & xml than it is like javascript.
                        > > Therefore, reasoning by precedent and analogy,
                        > > I think the right answer is text/json.

                        > I disagree that JSON is more like HTML and XML than like JavaScript,
                        > particularly when it's specifically a subset of JavaScript.

                        I agree with MarkM on this one. JSON is not JavaScript. While it is a
                        subset of JavaScript, its usage patterns are radically different. I
                        think the right answer is text/json.
                      • Martin Cooper
                        ... The usage patterns may be different, but if you read the portions of RFC 2046 that I quoted, those usage patterns still match application/json much better
                        Message 11 of 13 , Jul 29, 2005
                        View Source
                        • 0 Attachment
                          On 7/29/05, Douglas Crockford <douglas@...> wrote:
                          > > > JSON is more like html & xml than it is like javascript.
                          > > > Therefore, reasoning by precedent and analogy,
                          > > > I think the right answer is text/json.
                          >
                          > > I disagree that JSON is more like HTML and XML than like JavaScript,
                          > > particularly when it's specifically a subset of JavaScript.
                          >
                          > I agree with MarkM on this one. JSON is not JavaScript. While it is a
                          > subset of JavaScript, its usage patterns are radically different. I
                          > think the right answer is text/json.

                          The usage patterns may be different, but if you read the portions of
                          RFC 2046 that I quoted, those usage patterns still match
                          application/json much better than text/json.

                          --
                          Martin Cooper


                          >
                          >
                          >
                          >
                          >
                          > Yahoo! Groups Links
                          >
                          >
                          >
                          >
                          >
                          >
                          >
                        • Mark Miller
                          ... By the criteria you quoted, xml should be application/xml. -- Text by me above is hereby placed in the public domain Cheers, --MarkM
                          Message 12 of 13 , Jul 29, 2005
                          View Source
                          • 0 Attachment
                            Martin Cooper wrote:
                            > The usage patterns may be different, but if you read the portions of
                            > RFC 2046 that I quoted, those usage patterns still match
                            > application/json much better than text/json.


                            By the criteria you quoted, xml should be application/xml.


                            --
                            Text by me above is hereby placed in the public domain

                            Cheers,
                            --MarkM
                          • Martin Cooper
                            ... So? We re talking about JSON, not XML. Finding an example for which you disagree with the existing categorisation isn t much of a reason to not follow the
                            Message 13 of 13 , Jul 29, 2005
                            View Source
                            • 0 Attachment
                              On 7/29/05, Mark Miller <markm@...> wrote:
                              > Martin Cooper wrote:
                              > > The usage patterns may be different, but if you read the portions of
                              > > RFC 2046 that I quoted, those usage patterns still match
                              > > application/json much better than text/json.
                              >
                              >
                              > By the criteria you quoted, xml should be application/xml.

                              So? We're talking about JSON, not XML. Finding an example for which
                              you disagree with the existing categorisation isn't much of a reason
                              to not follow the spec when looking for the right categorisation for
                              JSON.

                              --
                              Martin Cooper


                              >
                              > --
                              > Text by me above is hereby placed in the public domain
                              >
                              > Cheers,
                              > --MarkM
                              >
                              >
                              >
                              >
                              >
                              > Yahoo! Groups Links
                              >
                              >
                              >
                              >
                              >
                              >
                              >
                            Your message has been successfully submitted and would be delivered to recipients shortly.