как лучше всего получить значения "Root_Zones" из нижеприведенного JSON?
Например, если мне нужно «Full_Name», я делаю:
UserConnectResponse.Result_Data.Full_Name,
но если мне нужны Root_Zones
, Successor_Zones
, Water_Source_Groups
, как я их получу? coz, как и я, дает ноль!
ЭТО ФУНКЦИОНАЛЬНЫЙ ЛОГИН C:
const saveDbData = async (data) => {
console.log('THE JSON DATA IS:', JSON.stringify(data) + ' ' + 'ROWS');
const UserConnectResponse = data;
await insertUserConnectResponseData(
UserConnectResponse.Req_Type,
UserConnectResponse.Language_Code,
UserConnectResponse.User_ID,
UserConnectResponse.Session_ID,
UserConnectResponse.Session_Key,
UserConnectResponse.Client_Type,
UserConnectResponse.Result_Code,
UserConnectResponse.Result_Message,
UserConnectResponse.Result_Data.Full_Name,
UserConnectResponse.Result_Data.Root_Zones,
UserConnectResponse.Result_Data.Successor_Zones,
UserConnectResponse.Result_Data.Water_Source_Groups
)
.catch((err) => console.log('ERROR AFTER INSERT:', err))
.then((result) => console.log('RESULT AFTER INSERT:', data, result));
const fetchawesome = await fetchUserConnectResponseData();
console.log('tblUserConnectResponseData AFTER INSERT IS: :', fetchawesome);
};
ЭТО JSON
{
"Req_Type": "string",
"Language_Code": "string",
"User_ID": "string",
"Session_ID": "string",
"Session_Key": "string",
"Client_Type": "string",
"Result_Code": 0,
"Result_Message": "string",
"Result_Data": {
"Full_Name": "string",
"Root_Zones": [
{
"Zone_ID": 0,
"Zone_Name": "string"
}
],
"Successor_Zones": [
{
"Zone_ID": 0,
"Zone_Name": "string"
}
],
"Water_Source_Groups": [
{
"Group_ID": 0,
"Group_Name": "string",
"Zone_ID": 0
}
]
},
"AccessDenied": "string"
}