Question

Possible Duplicate:
Please explain JSONP

Related question: Explanation and usage of JSONP.

I know what JSON is but what is JSON-P?

How do you pronounce JSON-P?

Was it helpful?

Solution

JSONP or "JSON with padding"

It helps grabbing JSON from external domains. It’s all about a cleaner way to get data objects (and other things) from the external domain. Its a workaround for cross domain JavaScript issues. Also supported by jQuery.

Technical details

OTHER TIPS

How do I pronounce it? Jayson Pee.

JSON-P = JSON with Padding

http://ajaxian.com/archives/jsonp-json-with-padding

http://en.wikipedia.org/wiki/JSON#JSONP

From Wikipedia:

"JSONP or "JSON with padding" is a JSON extension wherein a prefix is specified as an input argument of the call itself. This padding prefix is typically the name of a callback function, but may also be a variable assignment, an if statement, or any other Javascript statement prefix. The original proposition appears to have been made in the MacPython blog in 2005 [16] and is now used by many Web 2.0 applications such as Dojo Toolkit Applications, Google Toolkit Applications[17] and Web Services. Further extensions of this protocol have been proposed by considering additional input arguments as, for example, is the case of JSONPP[18] supported by S3DB web services. Because JSONP makes use of script tags, calls are essentially open to the world. For that reason, JSONP may be inappropriate to carry sensitive data.[19] Including script tags from remote sites allows the remote sites to inject any content into a website. If the remote sites have vulnerabilities that allow JavaScript injection, the original site can also be affected."

See Douglas Crockford’s The JSON Saga where he mentions another pronunciation for JSON at about 7:45.

Actually, while the other answers are good, JSON-P does not necessitate the use of JSON. You can use whatever data format you like, as long as it follows the same idea as JSON-P. It refers more to the process of supplying a callback to the server, which will be used in the JavaScript code which is returned in the response.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top