I have an object fetched from 3rd party API as shown below:
{
name:\"Luke Skywalker\",
__typename:\"People\",
Symbol(id):\"ROOT_QUERY.people.\"
}
Adding to @T.J. Crowder, Symbols can also be discovered through Reflect.ownKeys
which will list all object own keys: property names & symbols.
const data = {
name:"Luke Skywalker",
__typename:"People",
[Symbol("id")]:"ROOT_QUERY.people."
};
const sym = Reflect.ownKeys(data).find(s => {
return String(s) === "Symbol(id)";
});
console.log(sym ? data[sym] : "Symbol(id) not found");