【the waiter】announcement:
| | |
Function introduction
- Support parsing nested json strings and parsing nested objects based on recursion
- Supports parsing array json strings, and the first json string in the array will be taken for parsing
- Check whether the json string format is correct and output the wrong position
Example
Parsing nested json strings
{
"name": "test",
"age": 10,
"addr": "Chengdu, Sichuan",
"cls_info": [
{
"name": "Basketball class",
"teacher": "Teacher Zhang"
},
{
"name": "art class",
"teacher": "Teacher Li"
}
]
}
after treatment
export interface GenerateObj {
name: string;
age: number;
addr: string;
cls_info: ClsInfo[];
}
export interface ClsInfo {
name: string;
teacher: string;
}