Currently working on a project that requires converting a JSON object into a TypeScript array. The structure of 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 represents a serialized Java object where uiMessages variable is a HashMap in Java. The goal is to parse the uiMessages into a TypeScript Array consisting of uiMessage objects.
Here's what has been achieved so far:
@Injectable()
export class BootstrapService {
constructor(private http: Http) {}
getBootstrapInfo() {
return this.http.get('api/foo')
.map(response => {
response.json()
})
}
}
Looking for suggestions on the best way to accomplish this task.