My dilemma is sending a simplified version of an object to the server.
{
"fullName": "Don Corleone",
"actor": {
"actorId": 2,
"name": "Marlon",
"surname": "Brando",
"description": "Marlon Brando is widely considered the greatest movie actor of all time... ",
"heroList": [],
"photo": "C:\\projects\\files\\actor\\1532955376934.png"
},
"heroProfilePhoto": "data:image/png;base64,/9j/...
"production": {
"title": "The Godfather",
"imdbRate": 9.2,
"genre": "8",
"releaseDate": "1972-03-23T21:00:00.000Z",
"director": "Francis Ford Coppola",
"writer": "Mari Puzo",
"detail": "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son."
}
}"
I have two questions:
1) Is it possible to extract specific data using the replacer parameter in JSON.stringify() ?
{
"fullName": "Don Corleone",
"actor": {
"actorId": 2
}
}"
2) Can I at least extract certain information using the replacer parameter of JSON.stringify()?
{
"fullName": "Don Corleone",
"actor": {
"actorId": 2,
"name": "Marlon",
"surname": "Brando",
"description": "Marlon Brando is widely considered the greatest movie actor of all time... ",
"heroList": [],
"photo": "C:\\projects\\files\\actor\\1532955376934.png"
},
}"
When I use this syntax:
JSON.stringify(hero, ['fullName'])
Result -> "{"fullName":"Don Corleone"}"
However, with this line:
JSON.stringify(hero, ['fullName', 'actor'])
Result -> "{"fullName":"Don Corleone","actor":{}}"
I am puzzled as to why the 'actor' property is empty.