Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a JSON string of the below format; I want to access it's properties through javascript.

{
"Deductions": {
"Fix": [
{
"Amount": "5000.00",
"AmountRaw": 5000,
"Type": "Utilities Allowance Dedctn -(D)"
}
],
"Variable": []
},
"Earning": {
"Fix": [
{
"Amount": "123546.00",
"AmountRaw": 123546,
"Type": "Basic -(E)"
},
{
"Amount": "123546.00",
"AmountRaw": 123546,
"Type": "House Rent Allowance"
},
{
"Amount": "123546.00",
"AmountRaw": 123546,
"Type": "Trasport Allowance"
}
],
"Variable": [
{
"Amount": "10000.00",
"AmountRaw": 10000,
"Type": "Expense Reimbursement"
}
]
}
}
Posted

1 solution

The old way is to use eval, but it's not safe. Take a look here: JSON[^] and here: JSON.parse[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900