0

hi all i am working on json data to show it on mobile apps how to read this type of json data 'limitvalue'

previously im sending all data to one object and reading but now it is not understandable how to read can some suggest me with some sample example.

here is the json data that we want to use in that we need to show CoverageName and limitvalue.

 [{"CoverageName":"Business Income"},{"CoverageName":"Employee Benefits Liability","Values":
{"Employee Benefits Liability Limit":{"limitvalue":"1000000"}}},{"CoverageName":"Extended Period
ofIndemnity"},{"CoverageName":"Limited Blanket Additional Insured"},{"CoverageName":"Non Owned 
Including Hired Automobile Coverage"},{"CoverageName":"Per Location Aggregate"},
{"CoverageName":"Tenant Legal Liability","Values":{"Tenant Legal Liability Limit"
:{"limitvalue":"100000"}}},{"CoverageName":"Employee Dishonesty","Values":{"Employee Dishonesty  
Limit":{"limitvalue":"5000"}}},{"CoverageName":"Supplemental Payments_Third Party Attorneys
 Fees"},{"CoverageName":"Employment Practices Liability","Values":{"EPLI Limit":  
{"limitvalue":"100000"},"EPLI Deductible":{"deductablevalue":"2500"}}},{"CoverageName":"Included
Coverage Package"},{"CoverageName":"Business Owners","Values":{"General Liability Aggregate
Limit":{"limitvalue":"2000000"},"General Liability Occurrence Limit":
{"limitvalue":"1000000"},"Total Building Limit":{"limitvalue":"0.0"},"Total Contents Limit":
{"limitvalue":"0.0"},"Property Deductible":{"deductablevalue":"100000"}}}]
mahesh
  • 341
  • 1
  • 5
  • 13
  • Did you try this: http://stackoverflow.com/questions/4935632/how-to-parse-json-in-javascript ? – Tony Dec 13 '13 at 08:47
  • http://stackoverflow.com/questions/18932686/how-to-alert-json-file-data-from-javascript –  Dec 13 '13 at 08:50
  • hi,Tony,JSON.parse will not work for him,because his data is a json array – yoyo Dec 13 '13 at 08:51
  • we can read "CoverageName" but we need to read "limitvalue" ,"deductablevalue" – mahesh Dec 13 '13 at 11:42

3 Answers3

0

Try jquery $.getJSON

  $.getJSON('your_json_file', function(data) {                            

          answers=data.CoverageName;//Objects of your file like CoverageName              

        alert(JSON.stringify(answers)); //object name to string           
        });     
0

first get this data in object then this code will help you

var jsonData = yourData;
var table = "table";
for(var i=0; i<jsonData.length; i++)
{
    table += "<tr><td>"+jsonData[i].CoverageName+"</td><td>"+jsonData[i].Values+"</td><tr>";
}
table += "</table>";

$('#yourDivID').append(table);
Sohil Desai
  • 2,940
  • 5
  • 23
  • 35
0

Use $.parseJSON()

 Example  data_arr=$.parseJSON(data); //data json array
AAA
  • 142
  • 7