I am developing a function which return me json string from rest service to js. For this I develop a function on a button click which return me json string and call rest service. My js call click function is like -
$scope.try = function () {
alert("Hi")
Restangular.one("tasks/try").get().then(function (data) {
alert(data);
});
};
And my rest code for this call is -
@GET
@Path("/try")
@Timed
@Produces("application/json")
public String create() {
return "{\"id\":1,\"name\":\"A green door\",\"price\":12.5}";
}
I want this json string in ui as it is but it return me this string as object. I use angular js v1.3.16, jersey client v2.22.2 and spring. Please provide me some solution. Thanks in advance.