You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+93-33Lines changed: 93 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,24 +16,52 @@ Python wrapper to convert ``JSON`` into a human readable ``HTML Table`` represen
16
16
Features
17
17
--------
18
18
19
-
1. User-friendly Table fomat - easy to read and show.
20
-
2. If any value of some key is array of objects, and all keys of all those objects are same, it will auto-club them instead of creating a new row for each Object within Array. For eg: ```jsonObject = {"sampleData": [ {"a":1, "b":2, "c":3}, {"a":5, "b":6, "c":7} ] }```
21
-
3. Easy to style for different purposes. Pass table attributes so that generated Table can have custom attributes like class, etc..
19
+
* User friendly tablular fomat, easy to read and share.
20
+
* If value of the key is array of objects and all the keys are same(value of the key is a dict of list), the module will club by default. Eg.
22
21
22
+
.. code-block:: bash
23
+
24
+
input = {
25
+
"sampleData": [{
26
+
"a":1, "b":2, "c":3
27
+
}, {
28
+
"a":5, "b":6, "c":7
29
+
}]
30
+
}
31
+
32
+
will create only one row combining the results. This feature can be turned off by explicitly passing an argument ``clubbing = False``.
33
+
34
+
* Generated table can be provided some ``attributes`` explicitly. Eg. giving an ``id``, ``class`` or any ``data-*`` attribute.
`Click here <http://json2html.varunmalhotra.xyz/>`_ for the online demo.
41
+
42
+
List of valid arguments
43
+
-----------------------
44
+
45
+
``json2html.convert`` - The module's ``convert`` method accepts three different types of arguments being passed.
46
+
47
+
===================== ================
48
+
Argument Description
49
+
--------------------- ----------------
50
+
`json` a valid JSON
51
+
--------------------- ----------------
52
+
`table_attributes` `id="info-table"`/`class="bootstrap-class"`/`data-*` attributes can be applied to the generated table
53
+
--------------------- ----------------
54
+
`clubbing` turn clubbing of list with same keys of a dict / Array of objects with same key
55
+
===================== ================
28
56
29
57
Installation
30
-
-------------
58
+
------------
31
59
32
60
.. code-block:: bash
33
61
34
62
$ pip install json2html
35
63
36
-
Or, Download `here<https://github.com/softvar/json2html/tarball/0.3>`_ and run ``python setup.py install`` after changing directory to `/json2html`
64
+
Or, Download [here](https://github.com/softvar/json2html/releases) and run `python setup.py install` after changing directory to `/json2html`
<table id="info-table"class="table table-bordered table-hover"><tr><th>name</th><td>json2html</td></tr><tr><th>description</th><td>Converts JSON to HTML tabular representation</td></tr></table>
71
108
72
109
**Example 3:** Clubbing same keys of: Array of Objects
2. Daniel Lekic: [@lekic](https://github.com/lekic)
170
219
* Fixed issue with one-item lists not rendering correctly.
171
220
* General code cleanup, fixed all naming conventions and coding standards to adhere to PEP8 conventions.
172
221
173
-
Patches are highly welcomed.
222
+
Copyright and License
223
+
---------------------
224
+
225
+
The `MIT license <https://opensource.org/licenses/MIT>`_
226
+
227
+
Copyright (c) 2014-2017 Varun Malhotra
228
+
229
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
230
+
231
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
232
+
233
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 commit comments