Good evening. A question. How to make chrome so that when a json object or objects come from the backend, you can see what properties and fields it has in the console. I saw in people you can simply deploy the object, and there will be its fields, etc. I only have written that the object came, without specifics. On the backend spring, on the front end angular. Thank you in advance. chrome console

userService.getUser().success(function (data) { console.log("User : " + data); $scope.user = data; }); 
  • It looks like data is returned as a string, not as an object (data type). It may well be that will save the Content-type. - fedornabilkin
  • what do you mean by "save content-type"? Where do I need to add it or am I misunderstanding something? About the fact that the string is returned and not the object, I then turn to the specific fields of this object on the view, and everything works, so this is all the same object. - Aleksei
  • So the console is displayed as a string. - fedornabilkin
  • I added to the question from the top what the controller looks like, where the object is displayed on the console. Please tell me how then to change this line, so that it is not a string that is displayed, but an object. console.log ("User:" + data); - Aleksei
  • I understand what the problem is. If you do a concatenation of an object with a string, you get a string). - Aleksei

1 answer 1

In this case, the console displays the string

 console.log("User : " + data); 

To output an object directly, you can plus replace ,

 console.log("User : ", data);