JSPM

jsonview

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 91
  • Score
    100M100P100Q72045F
  • License MIT

jQuery plugin for display pretty JSON.

Package Exports

  • jsonview

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jsonview) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

jQuery JSONView

Formats & syntax highlights JSON.

Port of Ben Hollis's JSONView extension for Firefox: http://jsonview.com

Live demo

Usage

var json = {"hey": "guy","anumber": 243,"anobject": {"whoa": "nuts","anarray": [1,2,"thr<h1>ee"], "more":"stuff"},"awesome": true,"bogus": false,"meaning": null, "japanese":"明日がある。", "link": "http://jsonview.com", "notLink": "http://jsonview.com is great"};

$(function() {
  $("#json").JSONView(json);
  // with options
  $("#json-collasped").JSONView(json, {collapsed: true});
});

Options

{
  collapsed: false
}

Methods

// collapse nodes
$('#json').JSONView('collapse');

// expand nodes
$('#json').JSONView('expand');

// toggle nodes
$('#json').JSONView('toggle');

// toggle level1 nodes, also be supported in collapse and expand
$('#json').JSONView('toggle', 1)

Licence

MIT