For my current project I need to convert a json object to a typescript array. the json is as follows:
{
"uiMessages" : {
"ui.downtime.search.title" : "Search Message",
"ui.user.editroles.sodviolation.entries" : "Violated SOD entries"
},
"userInfo" : {
"login" : "fooUser",
"firstName" : "Foo",
"lastName" : "Bar",
"language" : "en"
},
"appInfo" : {
"applicationName" : "foo",
"applicationVersion" : "6.1.0"
}
}
The json is a serialized java object and the uiMessages variable is a Hashmap in java. I need to parse the uiMessages to a Typescript Array of uiMessage objects.
So far, I got to this:
@Injectable()
export class BootstrapService {
constructor(private http: Http) {}
getBootstrapInfo() {
return this.http.get('api/foo')
.map(response => {
response.json()
})
}
}
How would I best do this?