About the problem that the JSON.parse restore function reviver returns undefined?

problem description

I need to process an object, filter out some keys and modify a key value to get the structure I want. Handle it with JSON.parse combined with reviver function. But get the weird result of undefined .

Why can"t the following code get the results I want?
I can get the correct results now, but there are no errors in the following code. Please analyze why I can"t get the results I want.

the environmental background of the problems and what methods you have tried

operating environment: node V9.11.2

related codes

{ 
  id: "5c34650e307f782408c4501b",
  interName: "",
  opt: "mac",
  ruleStr: "00:0A:02:0B:03:0C",
  algorithmOptRules: "afafafafaf"
}
Apr.19,2022

12

because value is empty


use the reviver function

when traversing to the topmost value (parsed value), the argument passed in to the reviver function will be the empty string "". Be aware of this special case when writing reviver functions.
if(key === '') return value;     // 
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9dc3c-1985.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9dc3c-1985.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?