You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

json-viewer-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-viewer-js

One pretty json viewer by javascript

1.0.8
latest
npm
Version published
Weekly downloads
493
-24.62%
Maintainers
1
Weekly downloads
 
Created
Source

JSON Viewer

One pretty json viewer by javascript

Home page: json-viewer-js

Example

import JsonViewer from './jsonViewer';

const testJson = `{
  "example1": [
      {
          "name": "test01",
          "age": 18,
          "gender": 0,
          "student": true,
          "children": null
      },
      {
          "name": "test02",
          "age": 19,
          "gender": 1,
          "student": true,
          "children": null
      }
  ],
  "example2": {
      "friuts": ["apple", "grape", "jujube", "pear"],
      "transport": ["taxi", "bus", "metro", "plane", "train"]
  }
}`

new JsonViewer({
    container: document.body, 
    data: testJson, 
    theme: 'light', 
    expand: false
});

Output Example

Light theme

Dark theme

API Reference

NameTypeDescDefaultRequired
containerDOM ObjectDOM elementnulltrue
dataStringJson data for render'{}'true
themeStringConfig for different theme(light or dark)lightfalse
expandBooleanConfig for if expand when loadedfalsefalse

End

If you like it, please give me a star, thanks!

Powered for: My JSON Editor

Keywords

json

FAQs

Package last updated on 06 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts