Javascript Vue.js:更新数据库中的子json数据格式

Javascript Vue.js:更新数据库中的子json数据格式,javascript,json,vue.js,vuejs2,vue-resource,Javascript,Json,Vue.js,Vuejs2,Vue Resource,我只需要更新commented\u type列中的评级值。在Laravel上,我使用类似于注释的类型>评级。但是我不知道怎么做vue.js JSON列如下所示: commented_type {"type": "review", "rating": 5} updateReview: function () { var reviewData = { id:584, commented_type>rating:'4',//It does not

我只需要更新
commented\u type
列中的评级值。在Laravel上,我使用类似于注释的类型>评级。但是我不知道怎么做vue.js

JSON列如下所示:

commented_type
 {"type": "review", "rating": 5}



updateReview: function () {
    var reviewData = {
        id:584,
        commented_type>rating:'4',//It does not work like that
    };
    this.$http.patch('/review/584',reviewData).then((response) => {

        console.log(response.data);

    }, (response) => {
        // error callback
        console.log('error response review update')
    });
},

您的JSON当前是否为字符串形式?如果需要获取对象,请尝试使用JavaScript的
JSON.parse()

否则,听起来你只是在问JS。试试这个:

commented_type['rating']