I have an object, I want to send this object's simplified version 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 question::
1) Is it possible to extract something like this with replacer parameter of JSON.stringify() ?
{
"fullName": "Don Corleone",
"actor": {
"actorId": 2
}
}"
2) At least can I extract something like this with 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 am using like this it's okay:
JSON.stringify(hero, ['fullName']) Result -> "{"fullName":"Don Corleone"}"
But this :
JSON.stringify(hero, ['fullName', 'actor']) Result -> "{"fullName":"Don Corleone","actor":{}}"
Why actor property is empty?
JSON.stringify(hero, ['fullName', 'actor', 'name'])