Code Monkey home page Code Monkey logo

bonashen / jquery-jsontotable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jongha/jquery-jsontotable

0.0 2.0 0.0 515 KB

This plugin can convert JSON data type to table for html. JSON is used primarily to transmit data between a server and web application, as an alternative to XML. In these reasons todays many applications use json data format for data transferring. And you need json to table converter for html display.

Home Page: http://plugins.jquery.com/jsontotable/

License: MIT License

JavaScript 85.60% HTML 8.87% CSS 5.53%

jquery-jsontotable's Introduction

jQuery-JSONtoTable

Build Status Coverage Status Dependency Status

This plugin can convert JSON data type to table for html. JSON, or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs. It is used primarily to transmit data between a server and web application, as an alternative to XML. In these reasons todays many applications use JSON data format for data transferring. And you need JSON to table converter for html display. Let's fork and use this. Thanks.

Screenshot

Screenshot

Usage

This sample is how to use this plugin using an Array type. 'header' key is an option. Default value is 'true'. This option indicates whether a header of the table is showing or hiding.

<div id="jsontotable" class="jsontotable"></div>

var data = [[1, 2, 3], [1, 2, 3]];
$.jsontotable(data, { id: '#jsontotable', header: false });

And the following is how to use this plugin using an Object type.

<div id="jsontotable" class="jsontotable"></div>

var data = [{'Title1': 'Hello', 'Title2': 'Fine', 'Title3': 'Thank you'}, {'Title1': 'Hello', 'Title2': 'Fine', 'Title3': 'Thank you'}];
$.jsontotable(data, { id: '#jsontotable', header: false });

And you can also use the string. The following is how to use this plugin using an String type.

<div id="jsontotable" class="jsontotable"></div>

var data = '[[1, 2, 3], [1, 2, 3]]';
$.jsontotable(data, { id: '#jsontotable', header: false });

And you can also use the Object with custom attributes.

<div id="jsontotable" class="jsontotable"></div>

var data = [ { id: 'header', class: 'header-class', _data:['1', '2', '3'] }, {'Title1': '1', 'Title2': '2', 'Title3': '3'} ];
$.jsontotable(data, { id: '#jsontotable', header: false });

If you want to use the bootstrap style you can add 'className' key as follows.

<link href="bootstrap.min.css" rel="stylesheet">

$.jsontotable(data, { id: '#jsontotable', className: 'table table-hover' });

License

jQuery-JSONtoTable is available under the terms of the MIT License.

jquery-jsontotable's People

Contributors

allen-zh avatar clayperez avatar drsheff avatar jongha avatar lucidfrontier45 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.