Project:VisualEditor testing/TestingRefs

Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: experimental
Implementation Special
Description Checks the remote extension repositories in front of local version of installed extensions for update status.
Author(s) Moriel Schottlender (mooeypootalk)
Latest version 0.1.0 (2013-05-13)
MediaWiki Tested on 1.20
PHP 5.3+
Database changes No
License GPL
Example Screenshots


Translate the VisualEditor testing/TestingRefs extension if it is available at

Hello[1][2] [3]

Hello, world!


Douglas Crockford was the first to specify and popularize the JSON format.[4]

JSON was used at State Software Inc., a company co-founded by Crockford, starting in April 2001, and funded by Tesla Ventures. When State was founded in early 2001 by six former employees of, they agreed to build a system that used standard browser capabilities and provided an abstraction layer for Web developers to create stateful Web applications that had a persistent duplex connection to a Web server by holding the two http connections open and recycling them before standard browser time-outs if no further data were exchanged. The idea for the State Application Framework was developed by Chip Morningstar at State Software.[5][6] It was used in a project at for Cartoon Network, which used a plug-in with a proprietary messaging format to manipulate DHTML elements (this system is also owned by 3DO). Upon discovery of early AJAX capabilities, digiGroups, Noosh, and others used frames to pass information into the user browsers' visual field without refreshing a Web application's visual context, realizing real-time rich Web applications using only the standard HTTP, HTML and JavaScript capabilities of Netscape 4.0.5+ and IE 5+. Douglas Crockford then found that JavaScript could be used as an object-based messaging format for such a system. The system was sold to Sun Microsystems, and EDS. The Web site was launched in 2002. In December 2005, Yahoo! began offering some of its Web services in JSON.[7] Google started offering JSON feeds for its GData web protocol in December 2006.[8]

Although JSON was originally based on a non-strict subset of the JavaScript scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999[9]) and is commonly used with that language, it is a language-independent data format. Code for parsing and generating JSON data is readily available for a large variety of programming languages. JSON's Web site provides a comprehensive listing of existing JSON libraries, organized by language.

Data types, syntax and example[edit]

JSON's basic types are:

  • Number (double precision in JavaScript, generally depends on implementation)
  • String (double-quoted en:Unicode, with backslash)
  • Boolean (true or false)
  • Array (an ordered sequence of values, comma-separated and enclosed ins; the values do not need to be of the same type)
  • Object (an unordered collection of key:value pairs with the ':' character separating the key and the value, comma-separated and enclosed ins; the keys must be strings and should be distinct from each other)
  • null (empty)

Non-significant white space may be added freely around the "structural characters" (i.e. braces "{ }", brackets "[ ]", colons ":" and commas ",").

The following example shows the JSON representation of an object that describes a person. The object has string fields for first name and last name, a number field for age, an object representing the person's address and an array of phone number objects.

    "firstName": "John",
    "lastName": "Smith",
    "age": 25,
    "address": {
        "streetAddress": "21 2nd Street",
        "city": "New York",
        "state": "NY",
        "postalCode": 10021
    "phoneNumbers": [
            "type": "home",
            "number": "212 555-1234"
            "type": "fax",
            "number": "646 555-4567"

One potential pitfall of the free-form nature of JSON comes from the ability to write numbers as either numeric literals or quoted strings. For example, ZIP Codes in the northeastern U.S. begin with zeroes (for example, 07728 for Freehold, New Jersey). If written with quotes by one programmer but not by another, the leading zero could be dropped when exchanged between systems, when searched for within the same system, or when printed. In addition, postal codes in the U.S. are numbers but other countries use letters as well. This is a type of problem that the use of a JSON Schema (see below) is intended to reduce.

Since JSON is almost a subset of JavaScript, it is possible, but not recommended,[10] to parse most JSON text into an object by invoking JavaScript's eval() function. For example, if the above JSON data is contained within a JavaScript string variable contact, one could use it to create the JavaScript object p as follows:

 var p = eval("(" + contact + ")");

The contact variable must be wrapped in parentheses to avoid an ambiguity in JavaScript's syntax.[11]

The recommended way, however, is to use a JSON en:parser. Unless a client absolutely trusts the source of the text, or must parse and accept text that is not strictly JSON-compliant, one should avoid eval(). A correctly implemented JSON parser accepts only valid JSON, preventing potentially malicious code from being executed inadvertently.

 var p = JSON.parse(contact);

Browsers, such as Firefox 4 and Internet Explorer 8, include special features for parsing JSON. As native browser support is more efficient and secure than eval(), native JSON support is included in the recently-released Edition 5 of the ECMAScript standard.[12]

Despite the widespread belief that JSON is a JavaScript subset, this is not the case. Specifically, JSON allows the Unicode line terminators LINE SEPARATOR and PARAGRAPH SEPARATOR to appear unescaped in quoted strings, while JavaScript does not.[13] This is a consequence of JSON disallowing only "control characters". This subtlety is important when generating en:JSONP.

Unsupported native data types[edit]

JavaScript syntax defines several native data types that are not included in the JSON standard:[14] Date, Error, Regular Expression, and Function. These JavaScript data types must be represented as some other data format, with the programs on both ends agreeing on how to convert between the types. As of 2011, there are some de facto standards for e.g. converting between Date and String, but none universally recognized.[15][16] Other languages may have a different set of native types that must be carefully to deal with this type of conversion.


JSON Schema[17] is a specification for a JSON-based format for defining the structure of JSON data. JSON Schema provides a contract for what JSON data is required for a given application and how it can be modified. JSON Schema is intended to provide validation, documentation, and interaction control of JSON data. JSON Schema is based on the concepts from XML Schema, RelaxNG, and Kwalify, but is intended to be JSON-based, so that JSON data in the form of a schema can be used to validate JSON data, the same serialization/deserialization tools can be used for the schema and data, and it can be self descriptive.

JSON Schema is written up as an en:Internet-Draft, currently version 4.[18] There are several validators currently available for different programming languages,[19] each with varying levels of conformance.

Example JSON Schema:

    "name": "Product",
    "properties": {
        "id": {
            "type": "number",
            "description": "Product identifier",
            "required": true
        "name": {
            "type": "string",
            "description": "Name of the product",
            "required": true
        "price": {
            "type": "number",
            "minimum": 0,
            "required": true
        "tags": {
            "type": "array",
            "items": {
                "type": "string"
        "stock": {
            "type": "object",
            "properties": {
                "warehouse": {
                    "type": "number"
                "retail": {
                    "type": "number"

The JSON Schema above can be used to test the validity of the JSON code below:

    "id": 1,
    "name": "Foo",
    "price": 123,
    "tags": [ "Bar", "Eek" ],
    "stock": {
        "warehouse": 300,
        "retail": 20

MIME type[edit]

The official en:MIME type for JSON text is "application/json".[20]


  1. foo
  2. bar
  3. baz
  4. Video: Douglas Crockford — The JSON Saga, on Yahoo! Developer Network. In the video Crockford states: "I do not claim to have invented JSON ... What I did was I found it, I named it, I described how it was useful. ... So, the idea's been around there for a while. What I did was I gave it a specification, and a little Web site."
  6. - State Software Breaks Through Web App Development Barrier With State Application Framework: Software Lets Developers Create Truly Interactive Applications; Reduces Costs, Development Time and Improves User Experience - February 12, 2002 - PR Newswire
  7. - Using JSON with Yahoo! Web services - Yahoo! - July 3, 2009 - - October 11, 2007}}
  8. - Using JSON with Google Data APIs - Google - July 3, 2009
  9. - Introducing JSON - - Douglas Crockford - Douglas Crockford - May 28, 2009 - July 3, 2009
  10. JSON in JavaScript, on JSON's web page: "The eval function is very fast. However, it can compile and execute any JavaScript program, so there can be security issues [...]"
  11. - JSON in JavaScript - - July 9, 2008 - Douglas - Crockford - Douglas Crockford - September 8, 2008
  12. Standard ECMA-262
  13. JSON: The JavaScript subset that isn't - Magnus Holm - The timeless repository - May 15, 2011 - 2013-01-11 - 9212af0a8d2124b92a7e4c6355007e4b4b0ae71d}}
  14. RFC 4627
  15. jquery - How to format a JSON date? - Stack Overflow
  16. Dates and JSON - Tales from the Evil Empire
  17. JSON Schema
  18. JSON Schema draft 4
  19. JSON Schema implementations
  20. IANA - Application Media Types