Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript C#4.0 JSON
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 17-Dec-12 19:47pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

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



Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100