Editable JSON for Meteor - Click here for demo app
meteor add babrahams:editable-json
In a template, write:
{{> editableJSON}}
This will turn the current data context into an editable block of JSON.
After editing (which won't have any effect on the data context or make any database writes), you can retrieve the modified JSON, as a javascript object, with:
EditableJSON.retrieve();
If you do want immediate updates to a certain document in a certain collection to be persisted in mongo, just write:
{{> editableJSON collection="posts" document=post}}
where the helper post
is returning a document from the posts
collection. Or write document=this
if the surrounding data context is already a document from the posts
collection.
If you want to explicity pass a javascript object to the widget instead of using the surrounding data context:
{{> editableJSON json=myJSObjectFromAHelper}}
If you want several widgets operating on the screen at once:
{{> editableJSON json=JSObj1 store="custom1"}}
{{> editableJSON json=JSObj2 store="custom2"}}
And to retrieve these:
var JSObj1 = EditableJSON.retrieve("custom1");
var JSObj2 = EditableJSON.retrieve("custom2");
This is not intended for production use. Its purpose is to help build client degugging tools for Meteor developers.