JSON JSONP and P/JSON – Whats the difference?

IBM i

Feb 02

Lets start from a point where you know what JSON is right?

JSON

JavaScript Object Notation or JSON (/JAY-sən), is an open-standard file format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types. It is a very common data format used for asynchronous browser/server communication, including as a replacement for XML in some AJAX-style systems.

Data types in JSON include string, number, boolean, array

Simple Json might look like this:

{"name": "Nick","surname": "Litten", "website": "www.nicklitten.com"}

JSONP (also called P/JSON)

JSONP (JSON with padding) is used to request data from a server residing in a different domain than the client. JSONP enables sharing of data bypassing same-origin policy.

JSONP means its JSON with padding around it, normally used to request data from a server in a different domain.

Simple JsonP might look like

functioncallExample({"name": "Nick","surname": "Litten", "website": "www.nicklitten.com"});
53 / 100 SEO Score
Follow

About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.