I have below javascript method. I try to get the id from the data parameter.
data(spark, data){
console.log('receive ', data)
console.log(data.id)
}
the first output line is receive {id:1}
but the second output line is undefined
then I tried below method to convert the json string to object:
data(spark, data){
console.log('receive ', data)
console.log(JSON.parse(JSON.stringify(data)).id)
I still got the same output. Why can't I get the id from the input parameter?
EDIT1
I changed the parameter name to be different with the function name as below:
data(spark, d){
console.log('receive ', d)
console.log(JSON.parse(JSON.stringify(d)).id)
}
but I still got the same output.