Add ability to add new values to objects/arrays in the editor + update for jQuery 1.9+ #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To me, this was a big feature that was missing.. because it essentially made the editor only good for editing existing JSON, and even at that, only existing values. You couldn't add values to an array in a true UI fashion... you had to edit the full JSON string to add a new element then make it redraw the editor to get the new value in there.
My change adds a link below the "row" of an object or array and, when clicked, adds a new item to the object/array called "newKey#" where # increments as needed. The link to add the new value is also offset with the parent array/object to indicate where the new value will show up.
The changes to make it work with jQuery 1.9 are backwards compatible (changing .live() to .on()) but it seemed pretty reasonable to update jQuery itself to 1.9.
Also added a minified version of json2 and just realized as I was typing this... but I sort of retailored the README in a generic fashion which probably doesn't line up with what you want for your own creation/repo... which makes the pull request not as clean as it ought to be. Sorry about that. :(