.Net Core 2.0 API returning json with quotes around property name -
i have .net core application have updated 1.1 2.0. problem having json being returned. json contains javascript web token (jwt).
i have controller endpoint looks this...
[microsoft.aspnetcore.mvc.route("gettoken")] [microsoft.aspnetcore.authorization.allowanonymous] public iactionresult post([microsoft.aspnetcore.mvc.frombody] applicationuser applicationuser) { var authtokenjson = _authtokenservice.gettokenjson(_jwtoptions, applicationuser); return ok(authtokenjson.result); } under 1.1 version response endpoint looks when printed in browser console...
after upgrading 2.0 looks this...
note property names in quotes. causes issue front end angularjs application trying process object.
does know why happens , how fix it?
thank comments.
i have found 1.1 format able away doing in front end...
this.currenttoken = <string>response.json().access_token; but new format have add .parse call this...
this.currenttoken = <string> json.parse(response.json()).access_token; it works expected.


Comments
Post a Comment