如何在 angularjs 的视图部分将字符串转换为 JSON 数据

How to convert string into JSON data in view part of angularjs

你好,我有 JSON 形式的数据,我想将 option 的数据转换成 json 这样我就可以调用 optionName, optionSubName 在 angularjs 的视图部分

    [
    {
      "heading": "MakeUp Type / Selection",
      "option": "{"optionName":"Bridal Makeup","optionSubName":"Engagement,Tika / Godh Bharai,Ring Ceremony","optionDesc":""}",
      "values": null
    },
    {
      "heading": "Makeup Type",
      "option": "{"optionName":"Experienced","optionSubName":"","optionDesc":{"products":"Bobbie Brown,Makeup Forever and Premium Makeup Products","Makeup_Include":"Straightening,Blow Drys,Tong Curls,Updo's","Drapping":"Yes","Lashes":"Yes","Nail_Polish_Change":"Yes","Extension_Available":"Yes","Airbrush_Available":"Yes"}}",
      "values": null
    }
  ]

我已经尝试过了,但是使用 ng-repeat 无法正常工作 我已经使用了 {{data.option.optionName | JSON}},但在我看来 angularjs 部分无效,请帮助我如何达到我的目标?

对每个使用AngularJS:

angular.forEach(object, iterator, [context])

object: The object interate over.
iterator: The iterator function or the code.
context: Object to become context (using this) for the iterator function.

var app = angular.module('app', []);
    app.controller('AppController', ['$scope', '$http', 
      function($scope, $http) {
        $http.get('json/array.json').success(function(data) {
            $scope.array = data; 
              angular.forEach($scope.array, function(x){
                   console.log(x.optionName);  
               })
            });
        });

      }
    ]);