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 Add to Memories Share Next Entry


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)

[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.