Skip to content

Conversation

@tobz
Copy link

@tobz tobz commented Mar 7, 2013

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. :(

…le in the JSON editor. Added a background color for null values. Removed the old README and updated the markdown-based one instead. Added a minified version of json2. Updated jQuery to 1.9.1
DavidDurman added a commit that referenced this pull request Mar 7, 2013
Add ability to add new values to objects/arrays in the editor + update for jQuery 1.9+
@DavidDurman DavidDurman merged commit 705a9ff into DavidDurman:master Mar 7, 2013
@DavidDurman
Copy link
Owner

I like your change very much! Though I decided to revert the pull request (after I merged it already). The reason is that you completely changed the coding style. You're trying to put code in one line - some lines are about 260 characters containing many expressions separated by commas. This makes the code unreadable and is, in general, considered a bad practice.

Please try to keep the same code conventions (proper indentation, lines no longer than 80 characters, one statement per line separated by semicolons) and I'd be very happy to merge your pull request.

@tobz
Copy link
Author

tobz commented Mar 7, 2013

Roger! I have a terrible habit of forgetting to make pull requests that follow the style of the original project before I go crazy and reformat it to my liking. :)

I'll submit a new pull request with just the code changes following the original formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants