如何将JSON对象转换为Angular对象?

时间:2016-12-14 09:20:15

标签: angularjs

如何将长字符串转换为键值对?我的JSON对象是:

column = {
  "column_Name": "id",
  "table_Name": "calls",
  "full_Column_Name": "calls.id",
  "checked": false
}

我想要:

$scope.x = {
  column_Name: "id",
  table_Name: "calls",
  full_Column_Name: "calls.id",
  checked: false
}

1 个答案:

答案 0 :(得分:0)

要将JSON字符串转换为javascript对象,您可以;

$scope.x = JSON.parse(column);

更多信息here