1.0.7 • Published 4 years ago

pretty-json-string v1.0.7

Weekly downloads
2
License
-
Repository
github
Last release
4 years ago

PRETTY JSON ==

Simple library to render/format a JS obj to an HTML view.

I forked this-repo.

  • I removed dependency except jquery. (I will remove jquery too.)
  • Enable module import via npm.
  • Change code to es6
  • Remove mouse event and fold

Dependecies

  • JQuery 1.11.1 (DOM manipulation)

Download

npm install pretty-json-string

let prettyJson = require('pretty-json-string')
or
import prettyJson from 'pretty-json-string'
``
`
Usage
--
<pre>

//obj to render.
var obj = {
  name:'John Doe',
  age: 20,
  children:[{name:'Jack', age:5}, {name:'Ann', age:8}],
  wife:{name:'Jane Doe', age:28 }
}

var node = prettyJson(obj, {
  el:$('#elem'),
});


</pre>

Properties.
--
<b>el</b>: DOM elem to append the JSON-HTML view.
<br/>
<b>data</b>: the JSON data.
<br/>
<b>dateFormat</b>: <em>(optional)</em> format date, ex: "DD/MM/YYYY HH24:MI:SS". 
  - YYYY : year
  - YY : year
  - MM : month
  - DD : day
  - HH24 : hour 24-format
  - HH : hours
  - MI : minutes
  - SS : seconds
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago