You are viewing bluesmoon

[icon] Blue Swiss Cheese ( 브루 쉬쓰 치즈) - JSON has a type
View:Recent Entries.
View:Archive.
View:Friends.
View:Profile.
View:Website (The Blues side of the Moon).
View:Memories. Projects. Freshmeat.

Security:
Subject:JSON has a type
Time:01:49 am
IANA has officially registered a MIME type for JSON: application/json.

What this means is that if you return JSON data from a web service, then you should set your Content-type header to application/json.

PHP: header("Content-type: application/json");
Perl: print header(-type => 'application/json');
Most anything else: print "Content-type: application/json\r\n";
comments: Leave a comment Previous Entry Share Next Entry

teemus
Link:(Link)
Time:2006-04-28 08:35 pm (UTC)
Mighty strange, no? JavaScript being text/javascript, while JSON getting an application suffix?
(Reply) (Thread)


bluesmoon
Link:(Link)
Time:2006-04-28 08:37 pm (UTC)
I spoke to Douglas about this in the UK actually, and asked him this same question. His answer was that JSON is not really javascript (hence no text/javascript), and not really text (hence no text/*). Also, the IANA is less likely to hand out text/* types.
(Reply) (Parent) (Thread)

teemus
Link:(Link)
Time:2006-04-28 08:44 pm (UTC)
Ah. Anyways, I meant "prefix" in the earlier comment.
(Reply) (Parent) (Thread)

(Deleted comment)

bluesmoon
Link:(Link)
Time:2006-04-29 06:17 am (UTC)
the problem with NCST is that they develop too many things and then keep it under wraps, so the rest of the world catches up, gets the fame and then moves ahead while they stay where they are.
(Reply) (Parent) (Thread)


code_martial
Link:(Link)
Time:2006-04-30 04:18 am (UTC)
+1

Most of the "cool things" like JSON etc. are pretty ordinary. Some (like XML and SOAP) are atrocious. What really matters is how much exposure the publisher has within the developer community and how many top organisations are promoting the publication.
(Reply) (Parent) (Thread)

[icon] Blue Swiss Cheese ( 브루 쉬쓰 치즈) - JSON has a type
View:Recent Entries.
View:Archive.
View:Friends.
View:Profile.
View:Website (The Blues side of the Moon).
View:Memories. Projects. Freshmeat.