Getting Invalid character error in angularjs and response value is undefined
<p>I am using angularjs with Struts2.
I am able to send the request from angularjs to the Struts2 action class and get the json object there and set the json in response object in action but while retrieving the json in angularjs getting invalid character error in browser console and in debugging getting undefined for response object. Below is the code for the same:-</p>

<pre><code>angularModule.controller('ResultDatabaseCtrl',function($scope,$http){
                        $http.get('/url/test').then(function(response)
                        {
                            $scope.data=response;
                        })
});
</code></pre>

<p>And in the Struts2 action I am writing the below code:</p>

<pre><code>    public String Test() throws ServletException {

        response.setContentType("text/json");
        response.setHeader("Cache-Control","no-cache");

        try {
            aggOutput = Delegator.getInstance().processRequest(aggInput);
            response.getWriter().write((String) aggOutput.getValueObject());
        } catch(Exception e) {
            e.printStackTrace();
        }

        return null;
    }
</code></pre>

<p>Here in the <code>aggOutput.getValueObject</code> is having the JSON code in the format below:</p>

<pre><code>{ identifier: "id",items: [ { id:"1", name:"ABC", Age:12 },
{  id:"1", name:"PQR", Age:2 }]}
</code></pre>

<p>While retrieving the data in angularjs from controller getting response is undefined while debugging in browser and in console getting the below error:-</p>

<pre><code>SyntaxError: Invalid character

at uc (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js:15:466)

at $b (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js:82:358)

   at Anonymous function (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js:83:272)
  at n (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js:7:331)
</code></pre>