From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png

Release status: experimental

Implementation Hook
Description Allows using the JSON syntax to add semantic annotations to a wiki page.
Author(s) Jie Bao (baojietalk)
Latest version 0.1 (2012-05-12)
MediaWiki 1.17+
Database changes No
License GNU GPL v3 or later,
MIT License
Download Subversion [Help]

Browse source code
#Change Log

Hooks used

Translate the JSON extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The JSON extension simplifies modelling complex data structure on a semantic wiki using the JSON syntax. It is an extension of the Semantic MediaWiki extension.

What this extension does[edit]

This extension introduces a parser function "json". Example: suppose we are on page Foo with the wiki script:

  "name" : "John", 
  "address" : {
    "city" : "Boston",

The JSON extension will create the following triples

Foo#json1 name John
Foo#json1 address Foo#json2
Foo#json2 city Boston
Foo Has_subobject Foo#json1
Foo Has_subobject Foo#json2
Property:Has subobject is a special property defined by SMW since 1.7

Without using the JSON syntax, a wiki editor may have to explicitly create a set of short wiki pages or SMW subobjects (> SMW 1.7). The JSON syntax is shorter, and makes it easier to import data from JSON-enabled Web APIs.


This extension is dependent on SMW 1.7 or later. It will not work without SMW.

Download and install[edit]



or use SVN

svn co http://smwbp.googlecode.com/svn/trunk/mediawiki/extensions/JSON/JSON.php

Add the code to the "WIKI-PATH/extentions/JSON" folder.

Then append the following to LocalSettings.php of your MediaWiki installation:

require_once ( "$IP/extensions/JSON/JSON.php" );




You can query the generated semantic annotation using ask query as usual. To browse, e.g., Foo#json1, go to


The extension introduces two special properties

In the example given at the beginning, the following additional triples will be generated:

Foo#json1 Has_JSON_container Foo
Foo#json2 Has_JSON_container Foo
Foo#json1 Has_JSON_parent Foo
Foo#json2 Has_JSON_parent Foo#json1

Print a table of JSON nodes on a page, their parent JSON node, and their "name" property if exists.

[[Has JSON container::{{PAGENAME}}]]
|?Has JSON parent

Print the hierarchy of JSON objects contained on a page (this query requires Semantic Result Format 1.7.1 for tree format):

[[Has JSON container::{{PAGENAME}}]]
|parent=Has JSON parent


Currently the extension does not support list

Related Extensions[edit]