CINXE.COM
Working with Data and APIs: Structured Data | Open Government - Government of Canada
<!DOCTYPE html> <!--[if lt IE 9]><html lang="en" dir="ltr" class="no-js"><![endif]--> <!--[if gt IE 8]><!--> <html lang="en" dir="ltr" class="no-js" class="path-node page-node-type-page has-glyphicons"> <!--<![endif]--> <head> <meta charset="utf-8" /> <meta property="dcterms:title" content="Working with Data and APIs: Structured Data" /> <meta property="dcterms:language" content="eng" /> <meta property="dcterms:creator" content="Treasury Board of Canada Secretariat" /> <meta property="dcterms:service" content="OG-GO" /> <meta property="dcterms:accessRights" content="2" /> <meta name="description" content="Data is presented in different formats. This guide contains information, tips and suggestions on how to use some of the formats presented in the Open Data Portal as well as how to work with some of the application programming interfaces (APIs)." /> <meta name="abstract" content="Working with Data and APIs: Structured Data" /> <meta name="keywords" content="open government,open data,open information,open dialogue,proactive disclosure, access to information, open government partnership, open data catalog, government contracts, government grants and contributions,blog,app,map,data inventory,dataset,license,api" /> <link rel="canonical" href="http://open.canada.ca/en/working-data-api/structured-data" /> <meta name="dcterms.title" content="Working with Data and APIs: Structured Data" /> <meta name="dcterms.creator" content="Open Government, Treasury Board Secretariat of Canada" /> <meta name="dcterms.language" content="en" /> <meta name="Generator" content="Drupal 10 (https://www.drupal.org)" /> <meta name="MobileOptimized" content="width" /> <meta name="HandheldFriendly" content="true" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="https://www.canada.ca/etc/designs/canada/cdts/gcweb/v5_0_1/cdts/compiled/soyutils.js"></script> <script src="https://www.canada.ca/etc/designs/canada/cdts/gcweb/v5_0_1/cdts/compiled/wet-en.js"></script> <script src="https://www.googletagmanager.com/gtag/js?id=G-S9JG8CZVYZ" async></script> <script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag("js", new Date());gtag("config", "G-S9JG8CZVYZ");</script> <link rel="icon" href="/sites/default/files/favicon.ico" type="image/vnd.microsoft.icon" /> <link rel="alternate" hreflang="en" href="http://open.canada.ca/en/working-data-api/structured-data" /> <link rel="alternate" hreflang="fr" href="http://open.canada.ca/fr/utilisation-api/donnees-structurees" /> <title>Working with Data and APIs: Structured Data | Open Government - Government of Canada</title> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/core.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/controlgroup.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/checkboxradio.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/resizable.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/button.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/dialog.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/align.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/fieldgroup.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/container-inline.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/clearfix.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/details.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/hidden.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/item-list.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/js.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/nowrap.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/position-container.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/progress.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/reset-appearance.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/resize.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/sticky-header.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/system-status-counter.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/system-status-report-counters.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/system-status-report-general-info.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/tablesort.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/system/css/components/tree-child.module.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/ckeditor5/css/ckeditor5.dialog.fix.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/assets/vendor/jquery.ui/themes/base/theme.css?snkzks" /> <link rel="stylesheet" media="all" href="/core/modules/layout_discovery/layouts/onecol/onecol.css?snkzks" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.css" integrity="sha256-0XAFLBbK7DgQ8t7mRWU5BF2OMm9tjtfH945Z7TTeNIo=" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.1.1/7.x-3.x/drupal-bootstrap.css" integrity="sha512-ys0R7vWvMqi0PjJvf7827YdAhjeAfzLA3DHX0gE/sPUYqbN/sxO6JFzZLvc/wazhj5utAy7rECg1qXQKIEZOfA==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.1.1/8.x-3.x/drupal-bootstrap.css" integrity="sha512-NeUsPqZmMW00yaAQcZUfehldGZvXPMxxGeSK0VDW93D4k1KjwphOCxC+xAhy8nzbg1lZUVm87Hgv4mfrjPRS2g==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.2.0/7.x-3.x/drupal-bootstrap.css" integrity="sha512-MiCziWBODHzeWsTWg4TMsfyWWoMltpBKnf5Pf5QUH9CXKIVeGpEsHZZ4NiWaJdgqpDzU/ahNWaW80U1ZX99eKw==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.2.0/8.x-3.x/drupal-bootstrap.css" integrity="sha512-RW97y3NJvKoHrC7kKAGhui3/movrRnEU9v4CYhpxjG/NKo1gST+chGpAB3FHFCRu+bcA8O1r52XATJVAipMl/Q==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.3.1/7.x-3.x/drupal-bootstrap.css" integrity="sha512-3gQUt+MI1o8v7eEveRmZzYx6fsIUJ6bRfBLMaUTzdmNQ/1vTWLpNPf13Tcrf7gQ9iHy9A9QjXKxRGoXEeiQnPA==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.3.1/8.x-3.x/drupal-bootstrap.css" integrity="sha512-8Mzt38PeJH1L6wkYWCuxwo4emO75P2F7hY+kkC31jR+nboGjAdtGFJirJ8ABexweqpzSId4fY+jlc+4cw6xT7w==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/npm/@unicorn-fail/drupal-bootstrap-styles@0.0.1/dist/3.4.0/8.x-3.x/drupal-bootstrap.css" integrity="sha512-RUOeVmsTRyTAbl6b8I+bazmSEhlTmS2Dt58NMpOvED7LJ6qy4CnfSoVoHcQw4a1uFYNxzaeDUbD7lQ/7Vo7OTg==" crossorigin="anonymous" /> <link rel="stylesheet" media="all" href="/themes/custom/gcweb/css/style.min.css?snkzks" defer /> <link rel="stylesheet" media="all" href="/libraries/theme-gcweb/css/theme.min.css?snkzks" defer /> <link rel="stylesheet" media="all" href="/libraries/theme-gcweb/css/wet-boew.min.css?snkzks" defer /> <link rel="stylesheet" media="all" href="/libraries/theme-gcweb/css/messages.min.css?snkzks" defer /> <script src="https://assets.adobedtm.com/be5dfd287373/0127575cd23a/launch-f7c3e6060667.min.js"></script> <script src="https://use.fontawesome.com/releases/v5.10.0/js/all.js" defer crossorigin="anonymous"></script> </head> <body class="path-node page-node-type-page has-glyphicons" class="path-node page-node-type-page has-glyphicons" vocab="http://schema.org/" class="path-node page-node-type-page has-glyphicons" vocab="http://schema.org/" typeof="WebPage"> <div class="dialog-off-canvas-main-canvas" data-off-canvas-main-canvas> <section id="wb-lng" class="text-right"> <div class=container> <h2 class="wb-inv">Language selection</h2> <div class="region region-language-toggle"> <section class="language-switcher-language-url block block-language block-language-blocklanguage-interface clearfix" id="block-languageswitcher" role="navigation"> <ul class="links list-inline mrgn-bttm-0"> <li hreflang="fr" data-drupal-link-system-path="node/6154"> <a href="/fr/utilisation-api/donnees-structurees" class="language-link" hreflang="fr" data-drupal-link-system-path="node/6154">Français</a> </li> </ul> </section> </div> </div> </section> <div id="def-top"> <ul id="wb-tphp"> <li class="wb-slc"> <a class="wb-sl" href="#main-content">Skip to main content</a> </li> <li class="wb-slc visible-sm visible-md visible-lg"> <a class="wb-sl" href="#wb-info">Skip to "About government"</a> </li> <li class="wb-slc"> <a class="wb-sl" rel="alternate" href="?wbdisable=true">Switch to basic HTML version</a></li> </ul> <header role="banner"> <div id="wb-bnr" class="container" > <div class="row"> <div class="brand col-xs-5 col-md-4"> <a href="https://www.canada.ca/en.html"><img alt="" src="/libraries/theme-gcweb/assets/sig-blk-en.svg"><span class="wb-inv"> Government of Canada / <span lang="fr">Gouvernement du Canada</span></span></a> </div> <section id="wb-srch" class="col-lg-8 text-right visible-md visible-lg"> <h2>Search</h2> <form name="cse-search-box" class="form-inline" role="search" action="https://www.canada.ca/en/sr/srb.html" method="get"> <div class="form-group"> <label for="wb-srch-q" class="wb-inv">Search Canada.ca</label> <input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="Search Canada.ca"> <datalist id="wb-srch-q-ac"> </datalist> </div> <div class="form-group submit"> <button type="submit" id="wb-srch-sub" name="wb-srch-sub" class="btn btn-primary btn-small"><span class="glyphicon-search glyphicon"></span><span class="wb-inv">Search</span></button> </div> </form> </section> </div> </div> <nav class="gcweb-menu" typeof="SiteNavigationElement"> <div class="container"> <h2 class="wb-inv">Menu</h2> <button type="button" aria-haspopup="true" aria-expanded="false">Menu<span class="wb-inv"> principal</span> <span class="expicon glyphicon glyphicon-chevron-down"></span></button> <ul role="menu" aria-orientation="vertical" data-ajax-replace="https://www.canada.ca/content/dam/canada/sitemenu/sitemenu-v2-en.html"> </ul> </div> </nav> </header> </div> <div class="region region-breadcrumb"> <nav id="wb-bc" property="breadcrumb" role="navigation"> <h2 class="wb-inv">You are here:</h2> <div class="container"> <ol class="breadcrumb"> <li> <a href="https://www.canada.ca">Canada.ca</a> </li> <li> <a href="/en/homepage">Open Government</a> </li> <li> <a href="/en/using-open-data">Using and publishing Open Data and Information</a> </li> </ol> </div> </nav> </div> <div class="container"> <div class="highlighted"> <div class="region region-highlighted"> <div data-drupal-messages-fallback class="hidden"></div> </div> </div> </div> <main role="main" property="mainContentOfPage"> <div class="container"> <div class="region region-header"> <h1 id="wb-cont"> <span><span class="stacked"> <span> Structured Data</span>: <span>Working with Data and APIs</span> </span></span> </h1> <section id="block-technicalnotice" class="block block-block-content block-block-contentba7be731-2b4a-4460-96d0-c554eff3ad57 clearfix"> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><div class="container"> <div class="row"> <div class="col-md-12"> <div data-ajax-replace="/data/static/_site_messaging/header_od_ckan.en"></div> </div> </div> </div> </div> </section> </div> <section> </section> </div> <a id="main-content"></a> <div class="main-container container js-quickedit-main-content"> <div class="region region-content"> <article class="page full clearfix"> <div class="content"> <div class="layout layout--onecol"> <div class="layout__region layout__region--content"> <section class="block block-layout-builder block-extra-field-blocknodepagecontent-moderation-control clearfix"> </section> <section class="block block-layout-builder block-field-blocknodepagebody clearfix"> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><div class="guide"> <p>Data is presented in different formats. This guide contains information, tips and suggestions on how to use some of the formats presented in the Open Data Portal as well as how to work with some of the application programming interfaces (APIs).</p> <div class="mrgn-tp-lg mrgn-bttm-lg brdr-bttm"> <div class="row mrgn-bttm-sm"> <ul class="toc lst-spcd col-md-12"> <li class="col-md-4"><a class="list-group-item cust-active active" href="http://open.canada.ca/en/working-data-api/structured-data">Structured Data</a></li> <li class="col-md-4"><a class="list-group-item" href="http://open.canada.ca/en/working-data-api/geo-formats">Geo Formats</a></li> <li class="col-md-4"><a class="list-group-item" href="http://open.canada.ca/en/working-data-api/api">Application Programming Interfaces</a></li> <li class="col-md-4"><a class="list-group-item" href="http://open.canada.ca/en/working-data-api/connect-api">Connecting to an API</a></li> <li class="col-md-4"><a class="list-group-item" href="http://open.canada.ca/en/working-data-api/best-practices">Best Practices</a></li> </ul> </div> </div> <section> <p>Structured data is usually in the form of text but follows a specific format giving it machine readability. Some more complex formats may be in binary format such as maps and GIS related files. You will find many different formats in the Open Data Portal. This section covers some of the popular formats and provides some tips on how to work with them.</p> <h2>On this page</h2> <ul> <li><a href="#csv">CSV</a> <ul> <li><a href="#encoding">Character Encoding</a></li> <li><a href="#bom">Byte Order Mark (BOM)</a></li> </ul> </li> <li><a href="#json">JSON</a></li> <li><a href="#xml">XML</a></li> </ul> </section> <section> <h2 id="csv">CSV</h2> <p>The easiest method for working with a <strong>Comma-Separated Values (CSV)</strong> file is to use a spreadsheet application such as OpenOffice Calc or Microsoft Excel. Simply launch the application and open the .csv file to launch the application’s CSV import wizard.</p> <p><a class="button button-accent" href="/data/en/dataset?res_format=CSV">Browse CSV Datasets</a></p> <h3 id="encoding">Character Encoding</h3> <p>One important detail is to pay attention to <strong>Character Encoding</strong> which can affect how the data, mainly the text is parsed during the import. This will be more noticeable when dealing with languages such as French which contain <a href="http://en.wikipedia.org/wiki/Extended_ASCII">extended characters</a>.</p> <p>OpenOffice provides easy selection of the character encoding to be used. Figure 1 and Figure 2 illustrate an example where the downloaded CSV dataset file was encoded using a different format than the default UTF–8 for OpenOffice (illustration using NeoOffice).</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 1: Example of a CSV import wizard showing incorrect encoding</b></figcaption> <img alt="Figure 1" class="img-responsive center-block" src="/sites/default/files/legacy/csv-neo-import-utf8.png"></figure> <details><summary>Accessible description of Figure 1</summary> <p>Screenshot showing the comma-delimited file import wizard in Neo Office. The file being imported contains French extended characters. The user has selected UTF-8 as the character encoding. The preview area is displaying the characters incorrectly as it is not the proper character encoding for this file.</p> </details> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 2: A CSV file imported using the incorrect character encoding</b></figcaption> <img alt="Figure 2" class="img-responsive center-block" src="/sites/default/files/legacy/csv-neo-data-utf8.png"></figure> <details><summary>Accessible description of Figure 2</summary> <p>A comma-delimited file displayed in the Neo Office spreadsheet editor. The file contains French extended characters which were not properly imported due to using the incorrect character encoding.</p> </details> <p>Another common 8-bit character encoding in Canada is ISO–8859–1. In this scenario, selecting the ISO–8859–1 character encoding resolves the extended character issue as shown in Figure 3 and Figure 4.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 3: A CSV import wizard showing proper character encoding</b></figcaption> <img alt="Figure 3" class="img-responsive center-block" src="/sites/default/files/legacy/csv-neo-import-8859.png"></figure> <details><summary>Accessible description of Figure 3</summary> <p>Screenshot showing the comma-delimited file import wizard in Neo Office. The file being imported contains French extended characters. The user has selected the appropriate ISO-8859-1 encoding and the preview area is displaying the characters properly.</p> </details> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 4: A CSV file imported into NeoOffice using the proper character encoding</b></figcaption> <img alt="Figure 4" class="img-responsive center-block" src="/sites/default/files/legacy/csv-neo-data-8859.png"></figure> <details><summary>Accessible description of Figure 4</summary> <p>A comma-delimited file displayed in the Neo Office spreadsheet editor. The file contains French extended characters which were properly imported using the correct character encoding.</p> </details> <p>You may notice character encoding issues when opening a CSV file in Microsoft Excel as shown in Figure 5. For this example, we will be using Microsoft Excel in Microsoft Office Professional Plus 2010.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 5 - File opened in Excel using incorrect file encoding</b></figcaption> <img alt="Figure 5" class="img-responsive center-block" src="/sites/default/files/legacy/csv-excel-auto.png"></figure> <details><summary>Accessible description of Figure 5</summary> <p>A screenshot of a comma-delimited file opened in Excel showing incorrectly decoded French characters.</p> </details> <p>The character encoding can be manually selected using the data import wizard. The first step is to start with a new Excel workbook. Go to the Data tab and click on From Text which will launch the import wizard (Figure 6).</p> <p>The first step in the wizard is to select the appropriate encoding. In this example, we are selecting the UTF-8 encoding which is located near the bottom of the list. Once selected, you can preview the character decoding in the data preview pane of the wizard.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 6 - Selecting UTF-8 in Text Import Wizard</b></figcaption> <img alt="Figure 6" class="img-responsive center-block" src="/sites/default/files/legacy/csv-excel-import1.png"></figure> <details><summary>Accessible description of Figure 6</summary> <p>A screenshot showing Step 1 of 3 of the Text Import Wizard in Microsoft Excel. The file origin list box is open with Unicode UTF-8 selected.</p> </details> <p>The next step (Figure 7) allows you to specify the proper delimiter(s) used in the data file. Once again, the Data preview pane allows you to preview your data and see if it is parsing the data correctly.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 7 - Selecting delimiters in Text Import Wizard</b></figcaption> <img alt="Figure 7" class="img-responsive center-block" src="/sites/default/files/legacy/csv-excel-import2.png"></figure> <details><summary>Accessible description of Figure 7</summary> <p>A screenshot showing Step 2 of 3 of the Text Import Wizard in Microsoft Excel. The Comma delimiter is checked and the data preview pane is showing the data separated into columns.</p> </details> <p>Optionally, you can specify the data types for each of the columns (Figure 8). In most cases, simply clicking Finish will suffice.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 8 - Selecting data formats in Text Import Wizard</b></figcaption> <img alt="Figure 8" class="img-responsive center-block" src="/sites/default/files/legacy/csv-excel-import3.png"></figure> <details><summary>Accessible description of Figure 8</summary> <p>A screenshot showing Step 3 of 3 of the Text Import Wizard in Excel. This step has settings allows the user to set the data formats for each of the columns. The defaults are used for this example.</p> </details> <p>Figure 9 shows the characters properly decoded in Excel having used the Text Import Wizard.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 9 - Data imported into Excel using proper character encoding</b></figcaption> <img alt="Figure 9" class="img-responsive center-block" src="/sites/default/files/legacy/csv-excel-utf8.png"></figure> <details><summary>Accessible description of Figure 9</summary> <p>A screenshot showing a comma-delimited file imported into Excel using the Text Import Wizard. The French characters are shown properly having applied the appropriate character encoding.</p> </details> <h3 id="bom">Byte Order Mark (BOM)</h3> <p>You may discover an interesting special byte at the beginning of a file. This byte is called the Byte Order Mark or BOM. This marker is used to signal the size of the character encoding used in the UTF encoded file. For example, UTF–16 will render as <code>U+FEFF</code> (Figure 5) or <code>þÿ</code> in a text editor capable of displaying this value. In general, you do not need to concern yourself with the BOM as it is used by the application you are using. However, it can be a useful byte to help you select the correct file encoding during an import if you are having issues.</p> <figure class="mrgn-tp-lg mrgn-bttm-lg"> <figcaption class="text-center"><b>Figure 10: A Byte Order Mark in a data file</b></figcaption> <img alt="Figure 10" class="img-responsive center-block" src="/sites/default/files/legacy/file-bom.png"></figure> <details><summary>Accessible description of Figure 10</summary> <p>A Byte Order Mark displayed in a text editor.</p> </details> <h2 id="json">JSON</h2> <p><strong>J</strong>ava<strong>S</strong>cript <strong>O</strong>bject <strong>N</strong>otation (JSON) is a structured open data format that is lightweight and very well suited for mobile applications. It is used either natively or as a library available in most web and mobile development languages. Detailed information on JSON can be found on the <a href="http://www.json.org/">official JSON web site</a>. Here is a simple example of JSON data:</p> <pre class="wb-prettify linenums prettyprint"> "metadata":{ "request":{ "dateCreated":"2014-01-01T00:00:00+00:00", "name": "Example JSON Dataset" }, "items":[ { "name":"Item 1", "colour":"red" }, { "name":"Item 2", "colour":"blue" } ] } </pre> <p>We have lots of great examples of working with JSON data and RESTful APIs in various programing languages.</p> <p><a class="button button-accent" href="/data/en/dataset?res_format=JSON">Browse JSON Datasets</a></p> <h2 id="xml">XML</h2> <p>XML (e<strong>X</strong>tensible <strong>M</strong>arkup <strong>L</strong>anguage) defines a set of rules for encoding documents in machine-readable form. It is defined in the <a href="http://www.w3.org/TR/2008/REC-xml-20081126/">XML 1.0 Specification</a>.</p> <p><a class="button button-accent" href="/data/en/dataset?res_format=XML">Browse XML Datasets</a></p> </section> </div></div> </section> </div> </div> </div> </article> </div> </div> <div class="container"> <div id="def-preFooter"> <div class="pagedetails"> <div class="row"> <div class="col-sm-4 col-md-3 col-lg-3"> </div> <div class="wb-share col-sm-4 col-md-3 col-sm-offset-4 col-md-offset-6 col-lg-offset-6" data-wb-share='{"lnkClass": "btn btn-default btn-block"}'></div> </div> <dl id="wb-dtmd"> <dt>Date modified:</dt> <dd><time property="dateModified">2024-02-05</time></dd> </dl> </div> </div> </div> </main> <div id="def-footerr"> <footer id="wb-info"> <h2 class="wb-inv">About this site</h2> <div id="transactFooter" class="gc-main-footer"> <div class="container"> <nav> <h3>Government of Canada</h3> <ul class="list-col-xs-1 list-col-sm-2 list-col-md-3"> <li><a href="https://www.canada.ca/en/contact.html">All Contacts</a></li> <li><a href="https://www.canada.ca/en/government/dept.html">Departments and agencies</a></li> <li><a href="https://www.canada.ca/en/government/system.html">About government</a></li> </ul> <h4><span class="wb-inv">Themes and topics</span></h4> <ul class="list-unstyled colcount-sm-2 colcount-md-3"> <li><a href="https://www.canada.ca/en/services/jobs.html">Jobs</a></li> <li><a href="https://www.canada.ca/en/services/immigration-citizenship.html">Immigration and citizenship</a></li> <li><a href="https://travel.gc.ca/">Travel and tourism</a></li> <li><a href="https://www.canada.ca/en/services/business.html">Business</a></li> <li><a href="https://www.canada.ca/en/services/benefits.html">Benefits</a></li> <li><a href="https://www.canada.ca/en/services/health.html">Health</a></li> <li><a href="https://www.canada.ca/en/services/taxes.html">Taxes</a></li> <li><a href="https://www.canada.ca/en/services/environment.html">Environment and natural resources</a></li> <li><a href="https://www.canada.ca/en/services/defence.html">National security and defence</a></li> <li><a href="https://www.canada.ca/en/services/culture.html">Culture, history and sport</a></li> <li><a href="https://www.canada.ca/en/services/policing.html">Policing, justice and emergencies</a></li> <li><a href="https://www.canada.ca/en/services/transport.html">Transport and infrastructure</a></li> <li><a href="https://international.gc.ca/world-monde/index.aspx?lang=eng">Canada and the world</a></li> <li><a href="https://www.canada.ca/en/services/finance.html">Money and finance</a></li> <li><a href="https://www.canada.ca/en/services/science.html">Science and innovation</a></li> <li><a href="https://www.canada.ca/en/services/indigenous-peoples.html">Indigenous peoples</a></li> <li><a href="https://www.canada.ca/en/services/veterans.html">Veterans and military</a></li> <li><a href="https://www.canada.ca/en/services/youth.html">Youth</a></li> </ul> </nav> </div> </div> <div class="gc-sub-footer"> <div class="container d-flex align-items-center"> <nav> <h3 class="wb-inv">Government of Canada Corporate</h3> <ul> <li><a href="https://www.canada.ca/en/social.html">Social media</a></li> <li><a href="https://www.canada.ca/en/mobile.html">Mobile applications</a></li> <li><a href="https://www.canada.ca/en/government/about.html">About Canada.ca</a></li> <li><a href="https://www.canada.ca/en/transparency/terms.html">Terms and conditions</a></li> <li><a href="https://www.canada.ca/en/transparency/privacy.html">Privacy</a></li> </ul> </nav> <div class="wtrmrk align-self-end"> <img src="/libraries/theme-gcweb/assets/wmms-blk.svg" alt="Symbol of the Government of Canada"> </div> </div> </div> </footer> </div> </div> <script>_satellite.pageBottom()</script> <script>window.imConfigPath = "/invitation-manager/";</script> <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","pathPrefix":"en\/","currentPath":"node\/6154","currentPathIsAdmin":false,"isFront":false,"currentLanguage":"en"},"pluralDelimiter":"\u0003","suppressDeprecationErrors":true,"ajaxPageState":{"libraries":"eJxNjkEOwyAMBD9E4idFBlxE5bAIO6X8vuqhVW4zcxrOiHJwY11ek9Gftj6QQwTcfHCnjo6XjFtxQL32kDCE8rg6654rK8rOT36HB5rzFMMpdOPdXiWUNCVSUUTWzXxpbb84xbcImTdVcA7KC5cfuVr6jixCkwQNtszlpMgmH2QNUAw","theme":"gcweb","theme_token":null},"ajaxTrustedUrl":[],"bootstrap":{"forms_has_error_value_toggle":1,"popover_enabled":1,"popover_animation":1,"popover_auto_close":1,"popover_container":"body","popover_content":"","popover_delay":"0","popover_html":0,"popover_placement":"right","popover_selector":"","popover_title":"","popover_trigger":"click","tooltip_enabled":1,"tooltip_animation":1,"tooltip_container":"body","tooltip_delay":"0","tooltip_html":0,"tooltip_placement":"auto left","tooltip_selector":"","tooltip_trigger":"hover"},"date_modified":"2024-02-05","feedback_link":"\/forms\/contact-us","user":{"uid":0,"permissionsHash":"17c6f20d2bd6f628c6230a9f076ba6fb1f771db211762555ba43cd5d770997fe"}}</script> <script src="/core/assets/vendor/jquery/jquery.min.js?v=3.7.1"></script> <script src="/core/assets/vendor/underscore/underscore-min.js?v=1.13.6"></script> <script src="/core/assets/vendor/once/once.min.js?v=1.0.1"></script> <script src="/core/misc/drupalSettingsLoader.js?v=10.2.10"></script> <script src="/core/misc/drupal.js?v=10.2.10"></script> <script src="/core/misc/drupal.init.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/version-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/data-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/disable-selection-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/form-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/jquery-patch-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/scroll-parent-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/unique-id-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/focusable-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/ie-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/keycode-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/plugin-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/safe-active-element-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/safe-blur-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widget-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/labels-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/controlgroup-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/form-reset-mixin-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/mouse-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/checkboxradio-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/draggable-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/resizable-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/button-min.js?v=10.2.10"></script> <script src="/core/assets/vendor/jquery.ui/ui/widgets/dialog-min.js?v=10.2.10"></script> <script src="/libraries/wet-boew/js/wet-boew.min.js?snkzks"></script> <script src="/core/assets/vendor/tabbable/index.umd.min.js?v=6.2.0"></script> <script src="/core/assets/vendor/tua-body-scroll-lock/tua-bsl.umd.min.js?v=10.2.10"></script> <script src="/themes/custom/gcweb/js/citation.min.js?snkzks" defer></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.js" integrity="sha256-29KjXnLtx9a95INIGpEvHDiqV/qydH2bBx0xcznuA6I=" crossorigin="anonymous"></script> <script src="/themes/contrib/bootstrap/js/drupal.bootstrap.js?snkzks"></script> <script src="/themes/contrib/bootstrap/js/attributes.js?snkzks"></script> <script src="/themes/contrib/bootstrap/js/theme.js?snkzks"></script> <script src="/themes/contrib/bootstrap/js/popover.js?snkzks"></script> <script src="/themes/contrib/bootstrap/js/tooltip.js?snkzks"></script> <script src="/libraries/theme-gcweb/js/theme.min.js?snkzks"></script> <script src="/themes/custom/gcweb/js/wet-load.min.js?snkzks"></script> <script src="/core/misc/progress.js?v=10.2.10"></script> <script src="/themes/contrib/bootstrap/js/misc/progress.js?snkzks"></script> <script src="/core/assets/vendor/loadjs/loadjs.min.js?v=4.2.0"></script> <script src="/core/misc/debounce.js?v=10.2.10"></script> <script src="/core/misc/announce.js?v=10.2.10"></script> <script src="/core/misc/message.js?v=10.2.10"></script> <script src="/themes/contrib/bootstrap/js/misc/message.js?snkzks"></script> <script src="/core/misc/ajax.js?v=10.2.10"></script> <script src="/themes/contrib/bootstrap/js/misc/ajax.js?snkzks"></script> <script src="/core/misc/displace.js?v=10.2.10"></script> <script src="/core/misc/jquery.tabbable.shim.js?v=10.2.10"></script> <script src="/core/misc/position.js?v=10.2.10"></script> <script src="/core/misc/dialog/dialog.js?v=10.2.10"></script> <script src="/core/misc/dialog/dialog.position.js?v=10.2.10"></script> <script src="/core/misc/dialog/dialog.jquery-ui.js?v=10.2.10"></script> <script src="/core/modules/ckeditor5/js/ckeditor5.dialog.fix.js?v=10.2.10"></script> <script src="/core/misc/dialog/dialog.ajax.js?v=10.2.10"></script> <script src="/themes/contrib/bootstrap/js/misc/dialog.ajax.js?snkzks"></script> </body> </html>