background preloader

JSON

Facebook Twitter

JSON. JSONP. JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a different domain, something prohibited by typical web browsers because of the same-origin policy.

JSONP

JSONP takes advantage of the fact that browsers do not enforce the same-origin policy on <script> tags. Note that for JSONP to work, a server must know how to reply with JSONP-formatted results. JSONP does not work with JSON-formatted results. The JSONP parameters passed as arguments to a script are defined by the server. A typical JSONP request is similar to the following sample code: <! How it works[edit] To see how this technique works, first consider a URL request that returns JSON data. This JSON data could be dynamically generated, according to the query parameters passed in the URL. Here, a HTML <script> element specifies for its src attribute a URL that returns JSON: In this example, the received payload would be: Padding[edit] Rosetta Flash[edit] JSON. JSON (/ˈdʒeɪsən/ JAY-sən),[1] or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs.

JSON

It is used primarily to transmit data between a server and web application, as an alternative to XML. Although originally derived from the JavaScript scripting language, JSON is a language-independent data format. Code for parsing and generating JSON data is readily available in many programming languages. The JSON format was originally specified by Douglas Crockford. It is currently described by two competing standards, RFC 7159 and ECMA-404. History[edit] Although JSON was originally based on a non-strict subset of the JavaScript scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999[8]) and is commonly used with that language, it is a language-independent data format.

Data types, syntax and example[edit] JSON's basic types are: Data portability issues[edit] Using JSON in JavaScript[edit] Www.ietf.org/rfc/rfc4627.txt. JSON-RPC. History[edit] Usage[edit] JSON-RPC works by sending a request to a server implementing this protocol.

JSON-RPC

The client in that case is typically software intending to call a single method of a remote system. Multiple input parameters can be passed to the remote method as an array or object, whereas the method itself can return multiple output data as well. (This depends on the implemented version.) All transfer types are single objects, serialized using JSON.[2] A request is a call to a specific method provided by a remote system. Method - A String with the name of the method to be invoked.params - An Array of objects to be passed as parameters to the defined method.id - A value of any type, which is used to match the response with the request that it is replying to.

The receiver of the request must reply with a valid response to all received requests. Result - The data returned by the invoked method. Examples[edit] Version 1.0[edit] A simple request and response: Version 1.1 (Working Draft)[edit] Json Parser Online.