Help:JSON format

Jump to: navigation, search
JSON format
Outputs semantic data in JSON format
Available languages
Image collection
Further Information
Provided by: Semantic MediaWiki
Added: 1.4.2
Compatibility change: 1.8.0
Removed: still supported
Requirements: none
Format name: json
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
Authors: James Hong Kong, Jeroen De Dauw, Fabian Howahl
Categories: export · plaintext
Class: SMWJSON, SMWJSONResultPrinter, SMWExportPrinter
Table of Contents

↓ INFO ↓

The result format json is used to produce links to JSON files. The export syntax has changed starting with SMW 1.8.0.

The change in the export syntax was necessary to ensure a higher validity among export formats, a reliance on available serialization methods, and elimination of specific error prone conversion procedures.



Parameter Type Default Description
source text empty Alternative query source
limit whole number 100 The maximum number of results to return
offset whole number 0 The offset of the first result
link text all Show values as links
sort list of texts empty Property to sort the query by
order list of texts empty Order of the query sort
headers text show Display the headers/property names
mainlabel text no The label to give to the main page name
intro text empty The text to display before the query results, if there are any
outro text empty The text to display after the query results, if there are any
searchlabel text JSON Text for continuing the search
default text empty The text to display if there are no query results

Format specific

Parameter Type Default Description
prettyprint yes/no empty A pretty-print output that displays additional indents and newlines


{{#ask: [[Category:City]] [[located in::Germany]] 
| ?Area
| format=json

JSON output

Export (as pretty print)

    "printrequests": [
            "label": "",
            "typeid": "_wpg",
            "mode": 2
            "label": "Area",
            "typeid": "_qty",
            "mode": 1
    "results": {
        "Berlin": {
            "printouts": {
                "Area": [
                        "value": 891.85,
                        "unit": "km\u00b2"
            "fulltext": "Berlin",
            "fullurl": "http:\/\/localhost\/mw\/index.php\/Berlin",
            "namespace": 0,
            "exists": true
    "rows": 1

This documentation page applies to all SMW versions from 1.8.0 to the most current version.
Other versions: 1.4.2 – 1.7.1       Other languages: de

Help:JSON format en 1.8.0