Angular.toJson

Use this method, Input to be serialized into JSON.

    var temp;
    temp = angular.toJson(obj,pretty); 
    console.log(temp);
    
    //pretty(optional).If set to true, the JSON output will contain newlines and whitespace. 
    If set to an integer, the JSON output will contain that many spaces per indentation.
    (default: 2)
Splendid Salmon