json.human.js

Convert JSON to human readable HTML

  • 所有者: marianoguerra/json.human.js
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

json.human.js: Json Formatting for Human Beings

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

Who?

Mariano Guerra

Why?

At Event Fabric <http://event-fabric.com/>_ we need to display JSON to people
from all technical levels without being to technical but also without losing
information about the underlying JSON object.

How?

you can see js/demo.js in this repo for an example or use it live at the
project page <http://marianoguerra.github.io/json.human.js>_

::

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 using Bower <https://github.com/bower/bower>_ you
can just run::

bower install json-human --save

Alternatives

License?

MIT <http://opensource.org/licenses/MIT>_

主要指標

概覽
名稱與所有者marianoguerra/json.human.js
主編程語言JavaScript
編程語言CSS (語言數: 3)
平台
許可證
所有者活动
創建於2013-09-13 13:46:43
推送於2019-04-13 13:19:53
最后一次提交2019-04-13 14:19:35
發布數2
最新版本名稱0.1.1 (發布於 )
第一版名稱0.1 (發布於 )
用户参与
星數1k
關注者數29
派生數79
提交數53
已啟用問題?
問題數29
打開的問題數15
拉請求數9
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?