Javascript 脊梁骨Can.js?犹太人区DIY?我应该如何处理这些数据?

Javascript 脊梁骨Can.js?犹太人区DIY?我应该如何处理这些数据?,javascript,json,model-view-controller,node.js,backbone.js,Javascript,Json,Model View Controller,Node.js,Backbone.js,我正在开发一个应用程序,让我们的安全调度员更新包含当前道路和校园条件的页面。后端是一个nodejs/express堆栈,带有,数据是一个简单的JSON结构,如下所示: { "campus": {"condition": "open", "status": "normal"}, "roads": {"condition": "wet", "status": "alert"}, "adjacentroads": {"condition": "not applicable",

我正在开发一个应用程序,让我们的安全调度员更新包含当前道路和校园条件的页面。后端是一个nodejs/express堆栈,带有,数据是一个简单的JSON结构,如下所示:

{
    "campus": {"condition": "open", "status": "normal"},
    "roads": {"condition": "wet", "status": "alert"},
    "adjacentroads": {"condition": "not applicable", "status": "warning"},
    "transit": {"condition": "on schedule", "status": "normal"},
    "classes": {"condition": "on schedule", "status": "normal"},
    "exams": {"condition": "on schedule", "status": "normal"},

    "announcements" : "The campus is currently under attack by a herd of wild velociraptors. It is recommended that you do not come to campus at this time. Busses are delayed.",

    "sidebar": [
        "<p>Constant traffic updates can be heard on radio station AM1234. Traffic updates also run every 10 minutes on AM5678 and AM901.</p>",
        "<p>This report is also available at <strong>555-555-1234</strong> and will be updated whenever conditions change.</p>"
    ],

    "links": [
        {
            "category": "Transportation Links",
            "links": [
                {
                    "url": "http://www.localtransit.whatever",
                    "text" : "Local Transit Agency"
                },
                {
                    "url": "http://m.localtransit.whatever",
                    "text" : "Local Transit Agency Mobile Site"
                }
            ]
        },
        {
            "category": "Weather Forecasts",
            "links": [
                {
                    "url": "http://weatheroffice.ec.gc.ca/canada_e.",
                    "text" : "Environment Canada"
                },
                {
                    "url": "http://www.theweathernetwork.com",
                    "text" : "The Weather Network"
                }
            ]
        },
        {
            "category": "Campus Notices &amp; Conditions",
            "links": [
                {
                    "url": "http://www.foo.bar/security",
                    "text" : "Security Alerts &amp; Traffic Notices"
                },
                {
                    "url": "http://foo.bar/athletics/whatever",
                    "text" : "Recreation &amp; Athletics Conditions"
                }
            ]
        },
        {
            "category": "Wildlife Links",
            "links": [
                {
                    "url": "http://velociraptors.info",
                    "text" : "Velociraptor Encounters"
                }
            ]
        }

    ],

    "lastupdated": 1333151930179   
}
我想知道在客户端处理这些数据的最佳方式是什么,例如,在dispatchers用来更新数据的页面上。该页面包含选择校园、道路等条件、TinyMCE文本区域公告、侧边栏和文本输入链接。我愿意在必要时更改此数据结构,但在我看来,它工作得很好。我一直在研究主干网,还有Can.JS,但我不确定这两个是否适合

一些补充资料:

不需要单独更新数据结构中的单个项;我计划在保存后发布整个结构。也就是说。。。 实际上有两种不同的观点,一种是调度员的观点,另一种是他们的主管的观点。调度员只能通过下拉菜单更改校园、道路等条件,而且只能更改条件键;每个可能的条件都有一个默认状态。主管可以覆盖默认状态,并可以访问公告、侧栏和链接键。也许我真的需要重新思考之前关于立即发布整个事件的观点? 主管需要能够添加和删除链接,以及添加和删除整个链接类别。这意味着需要添加和删除DOM元素,这就是为什么我在考虑使用主干或Can.js之类的东西,而不是编写一些查看所有表单元素并构建适当JSON以发布到服务器的犹太区解决方案。
欢迎您的建议

CanJS非常适合嵌套数据。是继承,它允许您侦听对象结构中的任何更改

如果包括,则文档中有更强大的事件机制示例:

// create an observable
var observe = new can.Observe({
  name : {
    first : "Justin Meyer"
  }
})
  var handler;
//listen to changes on a property
observe.delegate("name.first","set", 
  handler = function(ev, newVal, oldVal, prop){

  this   //-> "Justin"
  ev.currentTarget //-> observe
  newVal //-> "Justin Meyer"
  oldVal //-> "Justin"
  prop   //-> "name.first"
});

// change the property
observe.attr('name.first',"Justin")