Below is a fraction of what I exported from WordPress database as .json file, I want to be able to iterate over the whole data with special attention to statutory_fees.
In a nutshell, I want to be able to access st_type: Land Survey, meanwhile, the I can currently access pid: 25
const data = [
{
"pid": "25",
"plotstatus": "Completed",
"statutory_fees": "[{"st_type":"Land Survey Plan","landsurveyplanamount":"150000","landsurveyplanamountpaid":"0","landsurveyplanfeebalance":"150000","landsurveyplanfeestatus":"Not Completed"},{"st_type":"Legal Fee","legalfeeamount":"50000","legalfeeamountpaid":"0","legalfeefeebalance":"50000","legalfeefeestatus":"Not Completed"},{"st_type":"Development\/Electrification Fee","development\/electrificationfeeamount":"200000","development\/electrificationfeeamountpaid":"0","development\/electrificationfeefeebalance":"200000","development\/electrificationfeefeestatus":"Not Completed"},{"st_type":"Registration Form Fee","registrationformfeeamount":"2000","registrationformfeeamountpaid":"0","registrationformfeefeebalance":"2000","registrationformfeefeestatus":"Not Completed"}]",
"contract_of_sale": "Not Collected",
"deed_of_assignmen": "Not Collected",
},
{
"pid": "25",
"plotstatus": "Completed",
"statutory_fees": "[{"st_type":"Land Survey Plan","landsurveyplanamount":"150000","landsurveyplanamountpaid":"150000","landsurveyplanfeebalance":"0","landsurveyplanfeestatus":"Completed"},{"st_type":"Legal Fee","legalfeeamount":"50000","legalfeeamountpaid":"50000","legalfeefeebalance":"0","legalfeefeestatus":"Completed"},{"st_type":"Development\/Electrification Fee","development\/electrificationfeeamount":"300000","development\/electrificationfeeamountpaid":"0","development\/electrificationfeefeebalance":"300000","development\/electrificationfeefeestatus":"Not Completed"},{"st_type":"Registration Form Fee","registrationformfeeamount":"2000","registrationformfeeamountpaid":"0","registrationformfeefeebalance":"2000","registrationformfeefeestatus":"Not Completed"}]",
"contract_of_sale": "Not Collected",
"deed_of_assignmen": "Not Collected",
}
]
I have tried the following ways:
let purfi = []
data.forEach(elem => {
JSON.stringify(elem.statutory_fees).replace(/\/g, '')
purfi.push(elem)
})
let veri = []
purfi.forEach(a=>{
JSON.parse(a.statutory_fees)
veri.push(a)
})
veri.forEach(a=>{
console.log(a.statutory_fees[0].st_type // undefined
})
Any help will go a long way.