{"id":16994945,"url":"https://github.com/jackadams/meteor-editable-json","last_synced_at":"2025-04-12T05:26:16.831Z","repository":{"id":28274486,"uuid":"31784954","full_name":"JackAdams/meteor-editable-json","owner":"JackAdams","description":"Editable JSON for Meteor","archived":false,"fork":false,"pushed_at":"2021-07-22T03:53:49.000Z","size":70,"stargazers_count":5,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T00:51:17.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://meteorpad.com/pad/AphADo6eR4aiJmNzS/Editable%20JSON%20Example","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JackAdams.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-06T19:20:22.000Z","updated_at":"2021-07-22T03:53:52.000Z","dependencies_parsed_at":"2022-08-26T14:34:36.535Z","dependency_job_id":null,"html_url":"https://github.com/JackAdams/meteor-editable-json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackAdams%2Fmeteor-editable-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackAdams%2Fmeteor-editable-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackAdams%2Fmeteor-editable-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackAdams%2Fmeteor-editable-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackAdams","download_url":"https://codeload.github.com/JackAdams/meteor-editable-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248521224,"owners_count":21118028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T03:47:08.678Z","updated_at":"2025-04-12T05:26:16.799Z","avatar_url":"https://github.com/JackAdams.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Editable JSON for Meteor - [Click here for demo app](http://meteorpad.com/pad/AphADo6eR4aiJmNzS/Editable%20JSON%20Example)\n===\n\nQuick Start\n---\n\n```\nmeteor add babrahams:editable-json\n```\n\nIn a template, write:\n\n```\n{{\u003e editableJSON}}\n```\n\nThis will turn the current data context into an editable block of JSON.\n\nAfter 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:\n\n```\nEditableJSON.retrieve();\n```\n\nIf you __do__ want immediate updates to a certain document in a certain collection to be persisted in mongo, just write:\n\n```\n{{\u003e editableJSON collection=\"posts\" document=post}}\n```\n\nwhere 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.\n\nMore advanced use\n---\n\nIf you want to explicity pass a javascript object to the widget instead of using the surrounding data context:\n\n```\n{{\u003e editableJSON json=myJSObjectFromAHelper}}\n```\n\nIf you want several widgets operating on the screen at once:\n\n```\n{{\u003e editableJSON json=JSObj1 store=\"custom1\"}}\n{{\u003e editableJSON json=JSObj2 store=\"custom2\"}}\n```\n\nAnd to retrieve these:\n\n```\nvar JSObj1 = EditableJSON.retrieve(\"custom1\");\nvar JSObj2 = EditableJSON.retrieve(\"custom2\");\n```\n\nYou can add callbacks (that fire on client only).\n\nAfter updates:\n```\nEditableJSON.afterUpdate(function (store, action, JSONbefore, documentsUpdated) {\n  // Overwrite this function in client side js to create a callback after every edit\t\n  // `this` in the callback function context is the document or the json AFTER the update\n  // `store` is the name of the data store as defined above (it will be `undefined` if not defined)\n  // `store` will be the collection name, if you're using the package to do direct updates to Mongo documents\n  // `action` is a Mongo update operator -- either `{$set: {field: value}}` or `{$unset: {field: 1}}`\n}[, store]);\n```\n\nIf you include the optional parameter `store` the callback will only fire when the specified store (or collection) is updated, otherwise it will fire on any update to any store/collection.\n\nIf a newly added field appears to be unpublished:\n```\nEditableJSON.onUnpublishedFieldAdded(function (collection, field, value) {\n  // Overwrite this function in client side js to alert user that they\n  // may not be seeing what they expect when adding new fields\n  // due to restrictions on the fields being published\n});\n```\n\nWARNING\n===\n\nThis is **not** intended for production use. Its purpose is to help build client debugging tools for Meteor developers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackadams%2Fmeteor-editable-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackadams%2Fmeteor-editable-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackadams%2Fmeteor-editable-json/lists"}