Need help deserializing JSON response into a class defined in Angular. Let's use the example class below:
export class ChatHubInfo {
hubUrl: string = undefined!
accessToken: string = undefined!
}
However, the JSON response is structured differently:
{
"hub_url": "https://localhost:8080/",
"access_token": "v4.public.eY..."
}
During deserialization, I need to map hub_url
to hubUrl
, and so on. In C#, I can easily achieve this using the [JsonPropertyName]
attribute, but I'm unsure of the equivalent in Angular.
Is it acceptable to have property names like 'hub_url', etc?