All Projects → badosa → Json Stat

badosa / Json Stat

Licence: other
JSON-stat Toolkit version 0

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Json Stat

World Cup.json
Free open public domain football data for the world cups in JSON incl. Russia 2018 and more - No API key required ;-)
Stars: ✭ 152 (+92.41%)
Mutual labels:  opendata, json
Football.json
Free open public domain football data in JSON incl. English Premier League, Bundesliga, Primera División, Serie A and more - No API key required ;-)
Stars: ✭ 632 (+700%)
Mutual labels:  opendata, json
Visidata
A terminal spreadsheet multitool for discovering and arranging data
Stars: ✭ 4,606 (+5730.38%)
Mutual labels:  opendata, json
Factbook.json
World Factbook Country Profiles in JSON - Free Open Public Domain Data - No API Key Required ;-)
Stars: ✭ 750 (+849.37%)
Mutual labels:  opendata, json
Vue Json Pretty
A JSON tree view component that is easy to use and also supports data selection.
Stars: ✭ 477 (+503.8%)
Mutual labels:  json, format
Kalulu
Uganda Elections Tools and Resources
Stars: ✭ 24 (-69.62%)
Mutual labels:  opendata, json
Json2go
Create go type representation from json
Stars: ✭ 76 (-3.8%)
Mutual labels:  json
Pytest Json Report
🗒️ A pytest plugin to report test results as JSON
Stars: ✭ 77 (-2.53%)
Mutual labels:  json
Dataiku Contrib
Public repository for DSS plugins
Stars: ✭ 76 (-3.8%)
Mutual labels:  opendata
Aus Search
A collection of Node JS scripts to create an Elasticsearch index of Australian addresses.
Stars: ✭ 76 (-3.8%)
Mutual labels:  opendata
Go Nulltype
Null friendly types
Stars: ✭ 79 (+0%)
Mutual labels:  json
Superseriousstats
superseriousstats is a fast and efficient program to create statistics out of various types of chat logs
Stars: ✭ 78 (-1.27%)
Mutual labels:  stats
Tortilla
Wrapping web APIs made easy.
Stars: ✭ 1,215 (+1437.97%)
Mutual labels:  json
Jsonp
Java API for JSON Processing (JSON-P)
Stars: ✭ 77 (-2.53%)
Mutual labels:  json
Json Mobx
Simple undo/redo and persistence for MobX
Stars: ✭ 78 (-1.27%)
Mutual labels:  json
Mirth Transforms
Welcome to Datica's open-source repository of Mirth Transforms and supplementary resources!
Stars: ✭ 77 (-2.53%)
Mutual labels:  json
Jsonifier
Fast and simple JSON encoding toolkit
Stars: ✭ 79 (+0%)
Mutual labels:  json
Feedparser
Parse feeds in Python
Stars: ✭ 1,200 (+1418.99%)
Mutual labels:  json
Covid19italia
Condividiamo informazioni e segnalazioni sul COVID19
Stars: ✭ 78 (-1.27%)
Mutual labels:  opendata
Dartson
Dartson is a Dart library that can be used to convert Dart objects into a JSON string.
Stars: ✭ 78 (-1.27%)
Mutual labels:  json

Important Notice

This is the repository of JSON-stat Javascript Toolkit version 0 (jsonstat module). This repository is frozen and is no longer maintained. JSON-stat Javascript Toolkit version 1 (jsonstat-toolkit module) is the current active release and is available in a new repository: https://github.com/jsonstat/toolkit.

JSON-stat Javascript Toolkit

The JSON-stat format is a simple lightweight JSON format for data dissemination. It is based in a cube model that arises from the evidence that the most common form of data dissemination is the tabular form. In this cube model, datasets are organized in dimensions. Dimensions are organized in categories.

The JSON-stat Javascript Toolkit (JJT) is part of the JSON-stat Toolkit. JJT's goal is to help dealing with JSON-stat responses in JavaScript.

Resources

Design principles

JSON-stat is based on a data cube information structure. The JSON-stat Javascript Toolkit exposes the data cube as a tree.

The JSON-stat tree

Datasets

Datasets are organized in dimensions and data.

  • Dataset
    • Dimension
      • Category
    • Data

Collections

Collections are sets of items. Items can be collections, datasets and dimensions (currently not supported by JJT).

  • Collection
    • Item

Generally, items in a collection contain just basic content and a pointer that allow a client to retrieve the full information about the item. But a collection can also contain the full information (embedded items).

Bundles (JSON-stat<2.0)

Bundles were packages of unordered arbitrary datasets.

  • Bundle
    • Dataset
      • Dimension
        • Category
      • Data

Even though JSON-stat currently encourages the use of collections of embedded datasets instead of bundles, JJT supports both approaches.

To retrieve information about the first category of the first dimension of the first embedded dataset in a JSON-stat collection (or bundle) j, the JSON-stat Javascript Toolkit allows you to traverse the JSON-stat tree like this:

JSONstat( j ).Dataset( 0 ).Dimension( 0 ).Category( 0 )

The class of the response can be checked using the class property:

if(JSONstat( j ).class==="dataset"){
   var cat0=JSONstat( j ).Dimension( 0 ).Category( 0 );   
}

General properties

  • label: label of the selected element (string)
  • length: number of children of the selected element (number).
  • id: IDs of the children of the selected element (array).

Reading and traversing methods

These methods (except JSONstat, which is not actually a method) accept a selection argument. If it is not provided, an array is returned with the information for every child of the selected element.

JSONstat

It reads a JSON-stat response and returns an object.

JSONstat( { ... } ).length
//number of datasets in the object

JSONstat( "https://json-stat.org/samples/oecd-canada-col.json" ).length
//number of items in oecd-canada-col.json. Sync connection. (Not available in the Node.js module.)

JSONstat( "https://json-stat.org/samples/oecd-canada-col.json",
   function(){
      console.log( this.length );
   }
)
//number of items in oecd-canada-col.json. Async connection. (Not available in the Node.js module.)

Dataset

It selects an embedded dataset in the JSON-stat collection (or bundle).

JSONstat( j ).Dataset( 0 ).id //IDs of the dimensions in the first dataset

Dimension

It selects a particular dimension in a dataset.

JSONstat( j ).Dataset( 0 ).Dimension( "time" ).label
//Label of the "time" dimension in the first dataset

JSONstat( j ).Dataset( 0 ).Dimension( "country" ).role
//Role of the "country" dimension in the first dataset

Category

It selects a particular category in a dimension in a dataset.

JSONstat( j ).Dataset( 0 ).Dimension( "time" ).Category( 0 ).label
//Label of the first category of the "time" dimension in the first dataset

Data

When an argument is passed, selects a single cell of the data cube in the JSON-stat response. If no argument is passed, returns all the cells.

The resulting object contains the property "value" (value of a cell) and "status" (its status).

JSONstat( j ).Dataset( 0 ).Data( 0 ).value
//Value of the first cell (usually a number, but values can be of any type).

JSONstat( j ).Dataset( 0 ).Data( [ 0, 0, 0 ] ).value
//Value of the first cell in a dataset with 3 dimensions (usually a number).

JSONstat( j ).Dataset( 0 ).Data( { "metric" : "UNR", "geo" : "GR", "time" : "2014" } ).value
//Unemployment rate in Greece in 2014 (usually a number).

JSONstat( j ).Dataset( 0 ).Data( { "metric" : "UNR", "geo" : "GR", "time" : "2014" } ).status
//Status of unemployment rate in Greece in 2014.

When the argument is neither an integer nor an array, single category dimensions (“constant dimensions”) can be skipped. If one and only one non-constant dimension is not specified, the result will be an array with as many elements as categories in the unspecified dimension.

Transformation methods

Transformation methods get information in the JSON-stat tree and export it to a different JSON structure for convenience.

toTable

This is a dataset method. It converts the information of a particular dataset into a JSON table. The conversion can be setup using an optional argument.

JSONstat( j ).Dataset( 0 ).toTable()
//Returns an array of arrays that exposes a tabular structure (rows and columns).
//Useful in many situations. For example, it can be a Google Visualization API input.

JSONstat( j ).Dataset( 0 ).toTable( { field : "id" } )
//Uses ids instead of labels as column names.

JSONstat( j ).Dataset( 0 ).toTable( { vlabel : "Valor", type : "object" } )
//Returns an object of arrays (of objects) that exposes a tabular structure (rows and columns)
//in the Google DataTable format (it's the native input format of Google
//Visualization API input). The "vlabel" property is instructing the method to use
//"Valor" as the label of the values column (instead of "Value").

JSONstat( j ).Dataset( 0 ).toTable( { status : true, slabel : "Metadata" } )
//The table will include a status column with label "Metadata".

JSONstat( j ).Dataset( 0 ).toTable( { type : "arrobj" } )
//Returns an array of objects where each dimension id is a property, plus a "value" property.

JSONstat( j ).Dataset( 0 ).toTable( { type: "arrobj", content: "id" } )
//same but category ids ("AU") are used instead of labels ("Australia") even for content.

JSONstat( j ).Dataset( 1 ).toTable(
   { type : "arrobj", content : "id" },
   function( d, i ){
      if ( d.sex === "F" && d.concept === "POP" ){
         return { age : d.age, population : d.value*1000 };
      }
   }
)
//Get only the female population by age of Canada
//and convert values from thousands to persons.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].