I've been messing around with JSON for some time, just pushing it out as text and it hasn't hurt anybody (that I know of), but I'd like to start doing things properly.
I have seen so many purported "standards" for the JSON content type:
application/json application/x-javascript text/javascript text/x-javascript text/x-json
But which one is correct, or best? I gather that there are security and browser support issues varying between them.
I know there's a similar question, What MIME type if JSON is being returned by a REST API?, but I'd like a slightly more targeted answer.
Contents. json files encode the attributes for elements represented by folders in the hierarchy. Each folder can contain one Contents. json file that encodes the attributes for the asset or group it contains.
What is/ are correct statements about JSON? The JSON format is often used for serializing and transmitting structured data over a network connection. JSON is language-independent, with parsers for each language supported.
JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).
JSON defines seven value types: string, number, object, array, true, false, and null. The following example shows JSON data for a sample object that contains name-value pairs.
For JSON text:
application/json
The MIME media type for JSON text is
application/json
. The default encoding is UTF-8. (Source: RFC 4627)
For JSONP (runnable JavaScript) with callback:
application/javascript
Here are some blog posts that were mentioned in the relevant comments:
text/html
for JSONapplication/json
IANA has registered the official MIME Type for JSON as application/json
.
When asked about why not text/json
, Crockford seems to have said JSON is not really JavaScript nor text and also IANA was more likely to hand out application/*
than text/*
.
More resources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With