- how to get the value inside without knowing the json string key?
for example, something like the following:
let result=
{
"err": 0,
"message": "",
"data": {
"fieldCount": 0,
"affectedRows": 1,
"insertId": 0,
"serverStatus": 2,
"warningCount": 0,
"message": "(Rows matched: 1 Changed: 0 Warnings: 0",
"protocol41": true,
"changedRows": 0
}
};
console.log(result.data.changedRows);//0
however, when I only know in the js program that result is a string of json, how to get the value in a similar situation.
- used the corresponding function to get it, but it was not successful.
let text=JSON.stringify(result);
console.log(text.data.changedRows);