angularjs convert variable value as key in json

Convert string value as key in json object


  1. $scope.attVal={"a":"fsdfsdfsd","b":"asdfas","c":"asdfas","d":"","e":"fas","f":"asd","g":"","h":"","i":"","j":"","k":""};

  2. $scope.selectedAttribute="a";
  3. $scope.attrValue="asdda";
  4. $scope.attVal[$scope.selectedAttribute]=$scope.attrValue;

In this example you can see, we are converting a string variable into a json key. and Updating old json by key.

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations