Answer the question
In order to leave comments, you need to log in
What is the correct way to write a class to represent data?
For example, I have JSON:
{
"name": "Tom",
"age": 24
}
I get this file with a GET request, and to represent the data I have a class
export class User {
name: string;
age: number
}
But what if I'm requesting not a small file that I wrote myself in two lines, but an API with a weather forecast for a week, how do I write this class in this case? Given that there are nested arrays and objects. Thanks in advance
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question