我想将JSON转换为java 我的json
var eateryRatingFactory = function() {
var self = this;
self.dineInMenu = [{
header: "Food",
items: [{
name: "Quality",
id: '1',
rating: '0'
},.....so on ]
},......so on ];
self.deliveryMenu = //some values same as beloew
};
我的java类
public class EateryRatingAdapter {
public List<Ratings> dineInMenu;
public List<Ratings> deliveryMenu;
//setters and getters
public class Ratings{
public String header;
public List<Item> items;
//setters and getters
public class Item{
public String name;
public String id;
public String rating;
//setters and getters
}
}
}
当我在Request主体获得JSON时,它会给出400个错误的请求意味着语法错误你们可以帮助解决这个问题
答案 0 :(得分:0)
使用Object Mapper
angular.module('app').controller('otherCtrl', function (CONSTANTS) {
$scope.otherCtrlvariable = CONSTANTS.something;
});