I want to parse a json response like that : { "code": "#546545" } from an angular 2 service. There are two ways that I know of:
Use an interface
export interface ProductId{ code: string; }
Since json is a string use: angular.fromJson(code)
I think 1 is an overkill for a single string along with what I know what is the best way for something so simple?
observableandpromisehave.json()method, so whateverresponseyou get, you can get yourjsonby that method.angularorangularjs?