A Lightweight Plugin for Binding/Linking JSON Data to Forms

JQuery-JSON-Form-Fields is a lightweight plug-in for linking JSON data to forms. Useful for working with AJAX and forms that contain a large number of fields.

JSON-form -inding.js is a plugin for creating a jQuery dynamic form that can be used to populate form fields with JSON data. Ideal for large forms with which you can quickly submit form data with AJAX.

populate form with json data jquery, populate html form with json data, jquery populate form fields from json, fill form with json data

How to make use of it:

1. Insert the minified version of the jQuery JSON-form-binding.js plugin after jQuery.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
<script src="jquery-json-form-binding.min.js"></script>

2. Create your individual type fields with distinctive names:

<div id="banner-message">
 <form id="myform">
        <div class="form-field">
                Text Input
            <input type="" name="name">

        <div class="form-field">
                Single Select
            <select name="country">
                <option value="usa">USA</option>
                <option value="uk">UK</option>
                <option value="germany">Germany</option>

        <div class="form-field">
                Multiple Select
            <select multiple name="skill">
                <option value="html">html</option>
                <option value="css">css</option>
                <option value="javascript">javascript</option>
                <option value="node">node</option>

        <div class="form-field">
                checkbox example
                <input type="checkbox" value="english" name="language" />English</label>
                <input type="checkbox" value="french" name="language" />French</label>
                <input type="checkbox" value="german" name="language" />German</label>

        <div class="form-field">
                Radio example
                <input type="radio" value="male" name="sex" />Male</label>
                <input type="radio" value="female" name="sex" />Female</label>

3. Call the function on the HTML form and outline your type information in a JSON object utilizing key/value pair as follows:

// jsonToForm library
$.fn.jsonToForm=function(a,c){var l=this,n={data:a||null,callbacks:c};null!=n.data&&$.each(n.data,function(a,c){var e=$('[name="'+a+'"]',l);null!=n.callbacks&&n.callbacks.hasOwnProperty(a)?n.callbacks[a](c):(e.length||c.length)&&$(e).each(function(n,e){Array.isArray(c)?c.forEach(function(a){$(e).is("select")?$(e).find("[value='"+a+"']").prop("selected",!0):$(e).val()==a&&$(e).prop("checked",!0)}):$(e).is(":checkbox")||$(e).is(":radio")?$(e).val()==c&&$(e).prop("checked",!0):$('[name="'+a+'"]',l).val(c)})})};

(function() {
  var json = {
                name: "Waleed",
                country: "uk",
                skill: ["html", "javascript"],
                language: ["english", "german"],
                sex: "female"


Populate Form Fields With JSON Data, JQuery-JSON-Form-Fields Plugin/Github

See Demo And Download

Official Website(devWaleed): Click Here

This superior jQuery/javascript plugin is developed by devWaleed. For extra advanced usage, please go to the official website.

Related Posts


How to Create a Simple Cookie Banner Consent Using Bootstrap 4

Cookie Consent Popup Javascript – Quick and simple tutorial for creating a simple Bootstrap cookie banner. If you have a website or blog with people visiting or…


Create Custom HTML Terminals With Pure JavaScript | shell.js

Custom HTML Terminals is A JavaScript library to create HTML terminals on web pages. The shell js JavaScript library offers a straightforward method to create Ubuntu, OS X,…


Bootstrap Alert, Confirm, and Flexible Dialog Boxes | Bootbox

Bootbox.js is a small JavaScript library that allows you to create programming dialogs using Bootstrap templates, without having to worry about creating, managing, or removing any required…


An Accessible Touch-enabled Slider Web Component | fg-carousel

fg-carousel Slider – A simple & modern slider web component to create versatile, accessible, touch-enabled picture carousels utilizing CSS scroll snap, Custom Element, and Intersection Observer API….


A Lightweight and Efficient Tags Input Component in Vanilla JS | tagify

tagify transforms an input field or textarea into a tags component, in an easy and customizable way, with great performance and a small code footprint, full of…


A Lightweight Library to Copy Text to Clipboard | CopyJS

CopyJS is a lightweight JavaScript library that allows you to copy plain text or HTML content to the clipboard. Must Read: Tiny Library for Copy Text In…