### Callback Function Setup for tbrowser Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Define a callback function to be executed when the table setup changes. The function receives the current table setup as an argument. ```javascript { rows: "geo", cols: "time", filters: { "sex": "F", "age": "15-64" } } ``` -------------------------------- ### Node.js Installation Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md Install the JSON-stat suite in your Node.js project using npm. This command downloads the package and its dependencies. ```bash $ npm install jsonstat-suite ``` -------------------------------- ### Browser ECMAScript Module Installation Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md Import the JSON-stat suite as an ECMAScript module for modern browsers. This method requires browser support for ES modules. ```html ``` ```html ``` -------------------------------- ### Browser Script Tag Installation Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md Include these script tags in your HTML to load the JSON-stat toolkit and suite via CDNs. Ensure you use the latest versions for compatibility. ```html ``` ```html ``` -------------------------------- ### Initialize tbrowser with JSON Object Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Initializes the table browser using a JSON-stat dataset provided as a JavaScript object. The 'preset' option can be used to customize the table's appearance. ```javascript JSONstatUtils.tbrowser( { "version" : "2.0", "class" : "dataset", "href" : "https://json-stat.org/samples/galicia.json", "label" : "Population by province of residence, place of birth, age, gender and year in Galicia", ... }, document.getElementById("tbrowser"), { preset: "smaller" } ); ``` -------------------------------- ### Preset Object Configuration for tbrowser Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Configure the initial layout of the table by specifying dimensions for rows, columns, and filters. Ensure all non-constant dimensions are included. ```javascript { rows: "geo", cols: "time", filters: { "sex": "F" } } ``` -------------------------------- ### Initialize tbrowser with JSON-stat Instance Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Initializes the table browser using a jsonstat-toolkit instance. This method is suitable when the JSON-stat data has already been processed by the toolkit. ```javascript var jsonstat={ "version" : "2.0", "class" : "dataset", "href" : "https://json-stat.org/samples/galicia.json", "label" : "Population by province of residence, place of birth, age, gender and year in Galicia", ... } ; JSONstatUtils.tbrowser( JSONstat( jsonstat ), document.getElementById("tbrowser"), { preset: "smaller" } ); ``` -------------------------------- ### Fetch and Process SDMX Data Source: https://github.com/jsonstat/suite/blob/master/test/iife.html This snippet demonstrates how to fetch data from an SDMX endpoint, convert it to JSON-stat format, and then process it using JSONstatUtils.datalist. It updates the DOM with the version and the generated datalist. ```javascript function test(sdmx){ var d=document, dl=JSONstatUtils.datalist( JSONstat( JSONstatUtils.fromSDMX(sdmx) ), { counter: true, tblclass: "datalist", numclass: "number", valclass: "value", vlabel: "VALUE", status: true, slabel: "STATUS" } ) ; d.getElementById("version").innerHTML=JSONstatUtils.version; d.getElementsByTagName("main")\[0\].innerHTML=dl; } fetch( "https://sdmx.oecd.org/public/rest/data/OECD.SDD.TPS,DSD\_PRICES@DF\_PRICES\_ALL,1.0/.M.N.CPI..\_T.N.GY+\_Z?startPeriod=2025-02&dimensionAtObservation=AllDimensions&format=jsondata" ).then(r => r.json()).then(test); ``` -------------------------------- ### Join Datasets Sequentially or by Dimension Source: https://github.com/jsonstat/suite/blob/master/docs/join.md This snippet demonstrates how to use `JSONstatUtils.join` to create a JSON-stat 2.0 dataset object from an array of parts. The join can be sequential or by a specified dimension, depending on the options provided. ```javascript var //Returns object in the JSON-stat format json=JSONstatUtils.join( resp ), //Returns jsonstat instance ds=JSONstat( json ) ; ``` -------------------------------- ### Display JSON-stat Data in a Table Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Fetches a JSON-stat dataset from a URL and displays it in an HTML element with a 'smaller' preset. Ensure the target element exists and the dataset has at least two dimensions. ```javascript JSONstat("https://json-stat.org/samples/galicia.json").then( function(j){ JSONstatUtils.tbrowser( j, document.getElementById("tbrowser"), { preset: "smaller" } ); } ); ``` -------------------------------- ### Observable Import Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md Import specific functions or the entire suite from the @jsonstat/suite package for use in Observable notebooks. This allows for modular usage. ```javascript import { toCSV, fromCSV, fromSDMX as SDMX } from "@jsonstat/suite" ``` ```javascript JSONstatUtils = import("jsonstat-suite@4.0.1/import.mjs") ``` -------------------------------- ### Node.js ES Module Import Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md Import the JSON-stat suite in your Node.js project using ES Module syntax. This is the modern standard for JavaScript modules. ```javascript import * as JSONstatUtils from "jsonstat-suite"; ``` -------------------------------- ### Convert SDMX-JSON to JSON-stat Source: https://github.com/jsonstat/suite/blob/master/docs/fromsdmx.md Use this snippet to convert an SDMX-JSON object to a JSON-stat dataset. The resulting dataset can then be processed into a jsonstat instance. Ensure the input is a valid SDMX-JSON object. ```javascript const jsonstat=JSONstatUtils.fromSDMX( sdmx ), ds=JSONstat( jsonstat ) ; console.log( ds.class ); //"dataset" ``` -------------------------------- ### Display Eurostat Data with JSONstat Suite (ES Module) Source: https://github.com/jsonstat/suite/blob/master/test/import.html Use this snippet to fetch data from a Eurostat API endpoint and display it as an HTML table using the JSONstat Suite's datalist function. Ensure your browser supports ECMAScript modules. ```javascript //For old browsers not supporting ES modules window.alert("Sorry, your browser does not support ECMAScript modules!"); import { datalist } from "https://unpkg.com/jsonstat-suite@latest/import.mjs"; //or https://cdn.jsdelivr.net/npm/jsonstat-suite@latest/import.mjs const url="https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/une_rt_a?lastTimePeriod=10&unit=PC_ACT&geo=EU27_2020", main=async function(url){ const res=await fetch(url), json=await res.json() ; document.querySelector("main").innerHTML=datalist( json, { counter: true, tblclass: "datalist", numclass: "number", valclass: "value", vlabel: "value" } ); } ; main(url); ``` -------------------------------- ### Convert CSV to JSON-stat Dataset Source: https://github.com/jsonstat/suite/blob/master/docs/fromcsv.md Demonstrates basic conversion of a CSV string to a JSON-stat dataset object with a custom label. The resulting dataset can be further processed into a jsonstat instance. ```javascript var csv="place of birth,age group,gender,year,province of residence,concept,value\n ..."; var jsonstat=JSONstatUtils.fromCSV( csv, { label: "Imported from a CSV" } ); var ds=JSONstat( jsonstat ); console.log( ds.label ); //"Imported from a CSV" console.log( ds.n ); //Number of data ``` -------------------------------- ### JSONstatUtils.join Source: https://github.com/jsonstat/suite/blob/master/docs/join.md Joins an array of JSON-stat 2.0 dataset objects into a single dataset. The join can be sequential or by a specified dimension. ```APIDOC ## JSONstatUtils.join ### Description Creates an object in the JSON-stat 2.0 dataset format from an array of objects in the JSON-stat 2.0 dataset format. The join can be sequential or by dimension. ### Method `JSONstatUtils.join( parts, options )` ### Parameters #### parts (array): required Array of objects in the JSON-stat 2.0 dataset format. The way the join will be performed depends on the *by* property in the **options** object. If no *by* is present, the join will be sequential (metadata + data + data + ...). In a sequential join, the first element in the **parts** array must be a representation of a dataset in the JSON-stat 2.0 dataset format with no data while the rest contain sequentially split data in the form of simplified JSON-stat 2.0 dataset responses (only the data part will be actually used). If *by* is present and is the name of an existing dimension, a join by dimension is performed. In a join by dimension, a big dataset has been previously split according to the different categories of a dimension. As a consequence, all datasets in the array share the dimensions and only differ in the categories available for the splitting dimension. #### options (object): optional ##### label (string): optional It is the label of the resulting dataset. Usually, this property won't be needed when a sequential join is performed, as the dataset label in the first element can be used. ##### by (string): optional It is the name of the dimension to be used in a join by dimension. ### Return Value It returns an object in the JSON-stat 2.0 dataset format. On error it returns *null*. ### Request Example ```js var //Returns object in the JSON-stat format json=JSONstatUtils.join( resp ), //Returns jsonstat instance ds=JSONstat( json ) ; ``` ``` -------------------------------- ### Convert JSON-stat URL to HTML Table with Counter Source: https://github.com/jsonstat/suite/blob/master/docs/datalist.md Fetches data from a JSON-stat URL and converts it into an HTML table, including a row counter. The resulting HTML is then inserted into the document's body. ```javascript JSONstat("https://json-stat.org/samples/galicia.json").then( function(j){ var html=JSONstatUtils.datalist( j, { counter: true } ); document.getElementsByTagName("body")[0].innerHTML=html; } ); ``` -------------------------------- ### JSONstatUtils.datalist Source: https://github.com/jsonstat/suite/blob/master/docs/datalist.md Converts JSON-stat data into an HTML table. It accepts a JSON-stat object or instance and optional configuration options. ```APIDOC ## JSONstatUtils.datalist ### Description Converts JSON-stat data into an HTML table where each row represents information about a cell in the original cube. The input JSON-stat must be of class "dataset", "collection" (with embedded datasets), or "bundle". ### Method Signature `JSONstatUtils.datalist(jsonstat, options)` ### Parameters #### jsonstat (object): required This can be a JSON-stat formatted object or a jsonstat instance (result of processing a JSON-stat object with jsonstat-toolkit). #### options (object): optional Configuration options for generating the HTML table. ##### counter (boolean) Includes a row counter column. Defaults to `false`. ##### status (boolean) Includes a status column. Defaults to `false`. ##### vlabel (string) Name for the value column. Defaults to "Value". ##### slabel (string) Name for the status column when `status` is `true`. Defaults to "Status". ##### na (string) String to display for unavailable values. Defaults to "n/a". ##### caption (string) Caption for the table. Defaults to the dataset label. ##### source (string) Text to prepend to the source information in the table footer. Defaults to "Source: ". ##### tblclass (string) Class attribute for the `
| ` and ` | ` elements in the value column. ##### numclass (string) Class attribute for ` | ` and ` | ` elements in numeric columns (value and counter).
##### locale (string)
BCP 47 language tag for formatting values using `Number.toLocaleString()`. Defaults to "en-US". Use "none" to disable.
##### dsid (positive integer or string)
Dataset index (integer) or ID (string) to select when the input is a collection or bundle. Defaults to 0 (the first dataset).
### Return Value
Returns an HTML table string. Returns `null` on error.
```
--------------------------------
### JSONstatUtils.tbrowser
Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md
Inserts an interactive table (table browser) displaying the data of a JSON-stat dataset inside an HTML document element. The JSON-stat input must be of class "dataset", "collection" (and have some embedded dataset) or "bundle". Currently, the JSON-stat dataset to be displayed must have at least two dimensions.
```APIDOC
## JSONstatUtils.tbrowser
### Description
Inserts an interactive table ("table browser") displaying the data of a JSON-stat dataset inside an HTML document element. The JSON-stat input must be of class "dataset", "collection" (and have some embedded dataset) or "bundle". Currently, the JSON-stat dataset to be displayed must have at least two dimensions.
### Method
```js
JSONstatUtils.tbrowser ( jsonstat , element [, options] )
```
### Parameters
#### jsonstat (object, string): required
It can be an object in the JSON-stat format, or a *jsonstat* instance (the result of a JSON-stat object processed by [jsonstat-toolkit](https://www.npmjs.com/package/jsonstat-toolkit)).
#### element (object): required
It specifies the element where the table will be inserted into. It must be an existing HTML element object.
### Request Example
```js
JSONstat("https://json-stat.org/samples/galicia.json").then(
function(j){
JSONstatUtils.tbrowser(
j,
document.getElementById("tbrowser"),
{
preset: "smaller"
}
);
}
);
```
### Request Example (JSON object)
```js
JSONstatUtils.tbrowser(
{
"version" : "2.0",
"class" : "dataset",
"href" : "https://json-stat.org/samples/galicia.json",
"label" : "Population by province of residence, place of birth, age, gender and year in Galicia",
...
},
document.getElementById("tbrowser"),
{
preset: "smaller"
}
);
```
### Request Example (JSONstat instance)
```js
var
jsonstat={
"version" : "2.0",
"class" : "dataset",
"href" : "https://json-stat.org/samples/galicia.json",
"label" : "Population by province of residence, place of birth, age, gender and year in Galicia",
...
}
;
JSONstatUtils.tbrowser(
JSONstat( jsonstat ),
document.getElementById("tbrowser"),
{
preset: "smaller"
}
);
```
```
--------------------------------
### JSONstatUtils.fromSDMX
Source: https://github.com/jsonstat/suite/blob/master/docs/fromsdmx.md
Converts SDMX-JSON data to JSON-stat format. Supports options for value and status representation, and returning a jsonstat instance.
```APIDOC
## JSONstatUtils.fromSDMX
### Description
Converts an object in the SDMX-JSON format to the JSON-stat dataset format. It supports various options to customize the output, including how values and statuses are represented, and whether to return a raw JSON-stat object or a jsonstat instance.
### Method Signature
`JSONstatUtils.fromSDMX( sdmx, [options] )`
### Parameters
#### sdmx (object): required
It must be an object in the SDMX-JSON format. Objects with more than one dataset are not supported. Only SDMX-JSON with a flat list of observations without any grouping (*dimensionAtObservation=allDimensions*) is fully supported. Support for intermediate grouping of observations (*series*) is experimental. Support for SDMX-JSON version 2 is also experimental.
#### options (object): optional
An object containing configuration options for the conversion.
##### ovalue (boolean): optional
When *true*, the *value* property in the resulting JSON-stat object will be an object instead of an array. By default, *false*.
##### ostatus (boolean): optional
When *true*, the *status* property in the resulting JSON-stat object, if present, will be an object instead of an array. By default, *false*.
##### instance (boolean): optional
When *true*, the return value of *fromSDMX* is not a JSON-stat object but a *jsonstat* instance. By default, *false*.
### Return Value
When **instance** is not specified or *false*, it returns an object in the JSON-stat format of class "dataset" that can be processed with [jsonstat-toolkit](https://www.npmjs.com/package/jsonstat-toolkit) to produce a *jsonstat* instance. When **instance** is *true*, it returns a *jsonstat* instance. On error it returns *null*.
### Request Example
```js
const sdmxData = { ... }; // Your SDMX-JSON object
const jsonstatData = JSONstatUtils.fromSDMX(sdmxData);
const ds = JSONstat(jsonstatData);
console.log(ds.class); // "dataset"
// Example with options
const jsonstatInstance = JSONstatUtils.fromSDMX(sdmxData, { ovalue: true, instance: true });
console.log(jsonstatInstance.dimension);
```
### Response Example
(Returns a JSON-stat object or a jsonstat instance, or null on error)
```json
{
"class": "dataset",
"label": "Example Dataset",
"source": "Example Source",
"id": ["geo", "time"],
"role": {
"time": ["time"],
"geo": ["geo"]
},
"dimensions": {
"geo": {
"class": "dimension",
"label": "Geography",
"category": {
"index": {
"USA": 0,
"CAN": 1
},
"label": {
"USA": "United States",
"CAN": "Canada"
},
"unit": {},
"order": ["USA", "CAN"]
}
},
"time": {
"class": "dimension",
"label": "Time",
"category": {
"index": {
"2020": 0,
"2021": 1
},
"label": {
"2020": "2020",
"2021": "2021"
},
"unit": {},
"order": ["2020", "2021"]
}
}
},
"value": [
100,
105,
110,
115
]
}
```
```
--------------------------------
### Node.js CommonJS Import
Source: https://github.com/jsonstat/suite/blob/master/docs/INSTALL.md
Require the JSON-stat suite in your Node.js project using CommonJS syntax. This is the standard way to import modules in older Node.js environments.
```javascript
const JSONstatUtils = require("jsonstat-suite");
```
--------------------------------
### Convert JSON-stat Instance to HTML Table
Source: https://github.com/jsonstat/suite/blob/master/docs/datalist.md
Converts a jsonstat-toolkit instance (created from a JSON-stat object) into an HTML table. This method is used when working with the jsonstat-toolkit library.
```javascript
var
jsonstat={
"version" : "2.0",
"class" : "dataset",
"href" : "https://json-stat.org/samples/galicia.json",
"label" : "Population by province of residence, place of birth, age, gender and year in Galicia",
...
},
html=JSONstatUtils.datalist( JSONstat( jsonstat ) )
;
```
--------------------------------
### JSONstatUtils.fromTable
Source: https://github.com/jsonstat/suite/blob/master/docs/fromtable.md
Converts an array with tabular data to the JSON-stat dataset format.
```APIDOC
## JSONstatUtils.fromTable
### Description
Converts an array with tabular data to the JSON-stat dataset format. This function performs the opposite conversion of the Transform method.
### Method Signature
`object JSONstatUtils.fromTable ( array tbl [, object options] )`
### Parameters
#### tbl (array): required
It must be an array in one of the types supported by the return values of the Transform method: "array" or "arrobj" (support for "object" is experimental). By default, an array of arrays with no status column is expected. Use **type**, **vlabel** and **slabel** options when this is not the case.
#### options (object): optional
* **type** (string): It describes the structure of the table. Supported structures are "array" and "arrobj". By default, "array".
* **vlabel** (string): It is the name of the value column. By default, "Value".
* **slabel** (string): It is the name of the status column. By default, "Status". If no column has the specified name, no status information will be included in the output.
* **label** (string): It is a text that will be used as the dataset label. By default, "".
* **ovalue** (boolean): When *true*, the *value* property in the resulting JSON-stat object will be an object instead of an array. By default, *false*.
* **ostatus** (boolean): When *true*, the *status* property in the resulting JSON-stat object, if present, will be an object instead of an array. By default, *false*.
* **drop** (array): It is an array of column labels to be dropped from the dataset. Only columns that do not act as dimensions (or are single-category dimensions) should be dropped.
* **instance** (boolean): When *true*, the return value of *fromTable* is not a JSON-stat object but a *jsonstat* instance. By default, *false*.
### Return Value
When **instance** is not specified or *false*, it returns an object in the JSON-stat format of class "dataset" that can be processed with jsonstat-toolkit to produce a *jsonstat* instance. When **instance** is *true*, it returns a *jsonstat* instance. On error it returns *null*.
### Example
```js
var
tbl=[
["Country", "Year", "Concept", "Sex", "Value"],
["Canada", "2015", "Population", "Male", 17776719],
["Canada", "2015", "Population", "Female", 18075055],
["Canada", "2015", "Population", "Total", 35851774]
],
jsonstat=JSONstatUtils.fromTable(
tbl,
{
"label": "Data from http://www.statcan.gc.ca/tables-tableaux/sum-som/l01/cst01/demo10a-eng.htm"
}
),
ds=JSONstat( jsonstat )
;
window.alert( ds.n ); //Number of data (3)
window.alert( ds.Data( {"Sex": "Total"} ).value ); //Total population (35,851,774)
```
```
--------------------------------
### Convert Table to JSON-stat
Source: https://github.com/jsonstat/suite/blob/master/docs/fromtable.md
Converts an array of tabular data into a JSON-stat dataset object. It then creates a jsonstat instance and demonstrates accessing the number of data points and a specific aggregated value.
```javascript
var
tbl=[
["Country", "Year", "Concept", "Sex", "Value"],
["Canada", "2015", "Population", "Male", 17776719],
["Canada", "2015", "Population", "Female", 18075055],
["Canada", "2015", "Population", "Total", 35851774]
],
jsonstat=JSONstatUtils.fromTable(
tbl,
{
"label": "Data from http://www.statcan.gc.ca/tables-tableaux/sum-som/l01/cst01/demo10a-eng.htm"
}
),
ds=JSONstat( jsonstat )
;
window.alert( ds.n ); //Number of data (3)
window.alert( ds.Data( {"Sex": "Total"} ).value ); //Total population (35,851,774)
```
--------------------------------
### Convert JSON-stat URL to CSV
Source: https://github.com/jsonstat/suite/blob/master/docs/tocsv.md
Fetches JSON-stat data from a URL and converts it to CSV format, including status information. The resulting CSV is then displayed in the HTML body.
```javascript
JSONstat("https://json-stat.org/samples/oecd.json").then(
function(j){
var csv=JSONstatUtils.toCSV(
j,
{
status: true, //Include status info
slabel: "status",
vlabel: "value"
}
);
document.getElementsByTagName("body")[0].innerHTML=""+csv+""; } ); ``` -------------------------------- ### JSONstatUtils.fromCSV Method Source: https://github.com/jsonstat/suite/blob/master/docs/fromcsv.md This method converts a CSV string into a JSON-stat dataset object. It accepts the CSV string and an optional options object to customize the conversion process. ```APIDOC ## JSONstatUtils.fromCSV ### Description Converts a string in the Comma-Separated Values (CSV) file format to the JSON-stat dataset format. ### Method Signature `object JSONstatUtils.fromCSV ( string csv [, object options] )` ### Parameters #### csv (string): required It must be a string in the Comma-Separated Values (CSV) format with a first row for labels and a column for each dimension, a column for values and optionally a column for statuses. By default, a CSV with values in the last column and no status column is expected. Use `vlabel` and `slabel` options when this is not the case. CSV-stat is also supported. #### options (object): optional Configuration object for the CSV to JSON-stat conversion. ##### vlabel (string) It is the name of the value column. When not provided, the value column must be the last one. When CSV-stat is detected, `vlabel` is ignored. ##### slabel (string) It is the name of the status column. By default, "Status". If no column has the specified name, no status information will be included in the output. When CSV-stat is detected, `slabel` is ignored. ##### delimiter (string) It is the character that will be used as the column separator. By default, ",". When CSV-stat is detected, `delimiter` is ignored. ##### decimal (string) It is the character that will be used as the decimal mark. By default, it is ".", unless `delimiter` is ";" (default decimal mark is then ","). When CSV-stat is detected, `decimal` is ignored. ##### label (string) It is a text that will be used as the dataset label. By default, "". When CSV-stat is detected, `label` is ignored. ##### ovalue (boolean) When *true*, the *value* property in the resulting JSON-stat object will be an object instead of an array. By default, *false*. ##### ostatus (boolean) When *true*, the **status** property in the JSON-stat object, if present, will be an object instead of an array. By default, *false*. ##### instance (boolean) When *true*, the return value of *fromCSV* is not a JSON-stat object but a *jsonstat* instance. ### Return Value When **instance** is not specified or *false*, it returns an object in the JSON-stat format of class "dataset" that can be processed with [jsonstat-toolkit](https://www.npmjs.com/package/jsonstat-toolkit) to produce a *jsonstat* instance. When **instance** is *true*, it returns a *jsonstat* instance. On error it returns *null*. ### Example ```js var csv = "place of birth,age group,gender,year,province of residence,concept,value\n ..."; var jsonstat = JSONstatUtils.fromCSV( csv, { label: "Imported from a CSV" } ); var ds = JSONstat(jsonstat); console.log(ds.label); //"Imported from a CSV" console.log(ds.n); //Number of data ``` ``` -------------------------------- ### Convert JSON-stat Object to HTML Table Source: https://github.com/jsonstat/suite/blob/master/docs/datalist.md Converts a JSON-stat formatted object directly into an HTML table. This is useful when the JSON-stat data is already available as an object in memory. ```javascript var html=JSONstatUtils.datalist( { "version" : "2.0", "class" : "dataset", "href" : "https://json-stat.org/samples/galicia.json", "label" : "Population by province of residence, place of birth, age, gender and year in Galicia", ... } ); ``` -------------------------------- ### Convert JSON-stat Instance to CSV Source: https://github.com/jsonstat/suite/blob/master/docs/tocsv.md Converts a JSON-stat instance (created using jsonstat-toolkit) to CSV format. This method is used when working with processed JSON-stat data. ```javascript var jsonstat={ "version" : "2.0", "class" : "dataset", "href" : "https://json-stat.org/samples/canada.json", "label" : "Population by sex and age group. Canada. 2012", ... }, csv=JSONstatUtils.toCSV( JSONstat( jsonstat ) ) ; ``` -------------------------------- ### Internationalization Messages for tbrowser Source: https://github.com/jsonstat/suite/blob/master/docs/tbrowser.md Customize user-facing messages for errors and table elements. This object allows for localization of the tbrowser interface. ```javascript { "urierror": 'tbrowser: A valid JSON-stat input must be specified.', "selerror": 'tbrowser: A valid selector must be specified.', "jsonerror": "The request did not return a valid JSON-stat dataset.", "dimerror": "Only one dimension was found in the dataset. At least two are required.", "dataerror": "Selection returned no data!", "source": "Source", "filters": "Filters", "constants": "Constants", "rc": "Rows & Columns", "na": "n/a" } ``` -------------------------------- ### Convert JSON-stat Object to CSV Source: https://github.com/jsonstat/suite/blob/master/docs/tocsv.md Converts a JSON-stat object directly into CSV format. This is useful when you already have the JSON-stat data in memory. ```javascript var csv=JSONstatUtils.toCSV( { "version" : "2.0", "class" : "dataset", "href" : "https://json-stat.org/samples/canada.json", "label" : "Population by sex and age group. Canada. 2012", ... } ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests. |
|---|