Skip to content

Installation

Xavier Badosa edited this page Mar 14, 2016 · 16 revisions

WikiInstallation

Download the latest version of json-stat.js.

Then include a link in your webpage to your copy of the json-stat.js file:

<script src="/your-js-dir/json-stat.js"></script>

The JSON-stat Javascript Toolkit (JJT) can be complemented with the JSON-stat Javascript Utilities Suite (JJUS), a high level library built on top of it. If you need the functionality provided by the JJUS, download the latest version of json-stat.utils.js.

Then include links in your webpage to your copies of the json-stat.js and json-stat.utils.js files:

<script src="/your-js-dir/json-stat.js"></script>
<script src="/your-js-dir/json-stat.utils.js"></script>

You can also download the full repository with tests.

Warning: When developing locally, your browser may enforce strict permissions for reading files out of the local file system. If you use JSONstat with a URI string that points to a local file, you will need to set up a local web server first. When passing a URI string, take also into account that JSONstat has limited old browsers support. Whenever you can, use an object instead.

The JJT can also be run on the server as a Node.js module. Type the following command to install:

npm install jsonstat

Once installed, you can run the test suite:

npm test jsonstat

This module has all the functionality of the client version except the connection capabilities (JSONstat accepts only a JSON-stat response object, not a URI string). Use Node.js’s built-in http module, or a module with a similar functionality (like got) to retrieve a remote JSON-stat response. See nodejs.js as an example.

Clone this wiki locally