Giter VIP home page Giter VIP logo

flexijsoneditor's Introduction

JSON editor jQuery plugin

A JSON editor component for you web apps/pages. Blog post

Live example

INSTALLATION

Include these lines into your HTML:

    <link rel="stylesheet" href="jsoneditor.css"/>
    <script src="jquery.min.js"></script>
    <script src="jquery.jsoneditor.js"></script>

USAGE

    var myjson = { any: { json: { value: 1 } } };
    var opt = { 
        change: function(data) { /* called on every change */ },
        propertyclick: function(path) { /* called when a property is clicked with the JS path to that property */ }
    };
    /* opt.propertyElement = '<textarea>'; */ // element of the property field, <input> is default
    /* opt.valueElement = '<textarea>'; */  // element of the value field, <input> is default
    $('#mydiv').jsonEditor(myjson, opt);

Bitdeli Badge

flexijsoneditor's People

Contributors

bitdeli-chef avatar daviddurman avatar rappid-deploy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flexijsoneditor's Issues

Showing long strings in keys and values

Since the boxes' width is fixed, long string (for keys and values both) may be truncated.
For keys (dark green boxes) adding a 'title' attribute should suffice.
For values you could do the same, or actually use a custom tooltip (you know how to write one, right?).

Delete item row with a click

Is there way to add a button on each item row to delete it? The "delete property value" to remove doesn't seem very friendly.
Thanks!

JsObject usually contain functions.

Hi, David, firstly I would like to thanks your owesome plugin,
I found a issue. please review it .
If the jsobject contains the function , the jsoneditor will show them in the tree. how to ignore the function in the editor? thanks.

Removing items from Array

When removing an item from an array (by deleting the key), the ui updates visually and looks as if the item is removed. However, in the data the array contains a hidden null entry, eg: [1, 2, 3, null]

Path bug when an array is being edited

If the initial object is an Array , there will be a bug when the first element is being edited, the path value which is supposed to be like this "0.number" would be like this "0number" ^^

Plus / Expand button does not appear when adding Array or Object

When adding a new Array or Object into the json, the plus symbol used to expand the item does not appear. This means there is no way to access the "Add New Value" button. Adding a new value below the value with the missing plus will refresh the view and cause the plus to appear.

path 0.0

if the path is 0.0 your item.data('path') will return 0 instead of 0.0 change to item.attr('data-path') solves the problem.

if you want a try:

[{"name":"html","type":"find","filter":".image-additional a"},{"name":"each","filters":[{"name":"html","type":"href"}]}]

TypeError: $(...).on is not a function

hi ~
i clone repository today , and i use the sample , i got a error message of "TypeError: $(...).on is not a function"

the bug since like update jquery lib will fix it , in repository jquery lib version is 1.6.2

Mars...^_^

How to display the REST json response as tree ?

while looking into the demo and the official page i couldn't understand how it is possible to dispaly a REST service response as json tree.

could you please share with me that how can i do to display json tree of REST Service response.
i tried the below code , but nothing is displayed in the page

var myjson = { any: { json: { value: 1 } } };
var opt = { 
    change: function(data) { /* called on every change */ },
    propertyclick: function(path) { /* called when a property is clicked with the JS path to that property */ }
};
/* opt.propertyElement = '<textarea>'; */ // element of the property field, <input> is default
/* opt.valueElement = '<textarea>'; */  // element of the value field, <input> is default
$('#mydiv').jsonEditor(myjson, opt);

please let me know that what is "#mydiv" , is that the div where the output tree is displayed ?

Compact arrays when manipulating indexes

If an index of an array is changed to a big number, the array is filled with null values. When the same index
is then changed back, the array still contains a lot of null values. It would make more sense if the array
was compacted.

Need an option to have only atomic values editable

Currently, a text field is generated for the object (or array) itself too where the complete json can be viewed and edited. To make editing more user-friendly, there should be an option so that a property's value can be edited only by going down deep in the hierarchy and finding the text field for that property. In other words, there would be no text fields for arrays or objects, only for numbers and strings.

Editing long strings in keys and values

You could actually expand the field (using a textarea, maybe).
For keys it's not really a big deal, since I can't see why really long strings should be used there, but for values it could be useful.

Editing 0th Element

Editing any value the 0th JSON Object (when multiple documents are loaded) results in a NULL value each time.

Editing the Name of any element on the 0th JSON Object (when multiple documents are loaded) also results in a NULL value each time.

Auto string detect

Hi,
Adding double quotes and escaping string yourself is a hassle.
Strings should also be auto escaped if needed.
Here is my proposed solution.

(it is a bit dirty and might need some work)

replace parse function with:

    function parse(str, parsed) {
        var res;
        var fail = false;
        try { res = JSON.parse(str); }
        catch (e) { res = null; if(parsed === true){error('JSON parse failed.')}; fail = true;}
        if(fail === true && parsed !== true){
            var j = $("<div/>").text(str.replace(/\n/g, '\\n'));
            j.text(j.html().replace(/"/g, '&quot;'));
            var val = j.html();
            res = parse('"'+val+'"', true);
        }
        return res;
    }

Now strings will be escaped and quoted automatically.
If the parameter added is an array object string number or bool it still perceived as such.
Only when it can't parse the data it will assume it is a string that needs formatting and escape it automatically.

all json properties are strings

Not sure if I have made a mistake or not but after editing, the JSON object's properties are all changed to strings even for numbers and boolean values.

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.