Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convert JSON to human readable HTML

NotificationsYou must be signed in to change notification settings

marianoguerra/json.human.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A small library to convert a JSON object into a human readable HTMLrepresentation that is easy to style for different purposes.

Who?

Mariano Guerra

Why?

AtEvent Fabric we need to display JSON to peoplefrom all technical levels without being to technical but also without losinginformation about the underlying JSON object.

How?

you can see js/demo.js in this repo for an example or use it live at theproject page

var node = JsonHuman.format(input);output.appendChild(node);

Additional options parameter can be supplied

var input = {      "url" : [            "www.google.com",            "www.google.com",            {              "x" : "x-direction",              "y" : "y-direction",              "url" : "www.google.com"            }      ]};var node = JsonHuman.format(input, {    // Show or hide Array-Indices in the output    showArrayIndex: true,    // Hyperlinks Option    // Enable <a> tag in the output html based on object keys    // Supports only strings and arrays    hyperlinks : {        enable : true,        keys: ['url'],          // Keys which will be output as links        target : '_blank'       // 'target' attribute of a    },    // Options for displaying bool    bool : {        // Show text? And what text for true & false?        showText : true,        text : {            true : "Yes",            false : "No"        },        // Show image? And which images (urls)?        showImage : true,        img : {            true : 'css/true.png',            false : 'css/false.png'        }    }});

To install it, if you're usingBower youcan just run:

bower install json-human --save

Alternatives

License?

MIT

About

Convert JSON to human readable HTML

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp