ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 254.8k

How to access object and values on json and display as table

Feb 11 2020 2:55 AM
problem
 
How to access object and values from json and display as table on angular 7 ?
 
I need to loop within object json below then get values from json and display all objects on columns
and rows as values
 
if other qualification array have application on fn attribute then 
show exist
else
show not exist 
 
html view will be as below  
 
 Features  18831983  946447  946451
Compliance  
RS - Not Compliant
RV - 2015/863
 
RS- Not Compliant
RV- 2019/863
 
RS-Compliant
RV- 2020/863
 OtherQualification  NotExist  NotExist  Exist
service.ts
  1. how to call api having link retun json below  
  2. https://localhost/api/getallfeatures  
component.ts 
  1. objJson : any ;  
  2. ngOnInit() {  
  3. // call service
  4.   
  5. }  
 component.html
  1. How to execute ts to get view desired result as first post  
json object as below :
  1. {  
  2.     "took": 2,  
  3.     "timed_out": false,  
  4.     "_shards": {  
  5.         "total": 1     
  6.     },  
  7.     "hits": {  
  8.         "total": {  
  9.             "value": 104  
  10.         },  
  11.         "max_score": 1.0,  
  12.         "hits": [  
  13.             {  
  14.                 "_index": "partsdb",  
  15.                 "_type": "_doc",  
  16.                 "_source": {  
  17.                     "PID": 18831983,  
  18.                     "CID": 1006091,                  
  19.                       
  20.                     "Compliance": [  
  21.                         {  
  22.                             "RS": "Not Compliant",  
  23.                             "RV": "2015/863"  
  24.                         }  
  25.                     ],  
  26.                                        
  27.                     "OtherQualification": [  
  28.                         {  
  29.                             "FN": "Calculated Failure Rate(FIT)",  
  30.                             "FV": "33.19",  
  31.                             "R": 293650338  
  32.                         },  
  33.                         {  
  34.                             "FN": "Confidence Level(UCL)",  
  35.                             "FV": "60%",  
  36.                             "R": 293650338  
  37.                         },  
  38.                         {  
  39.                             "FN": "Fails Quantity",  
  40.                             "FV": "0",  
  41.                             "R": 293650338  
  42.                         }  
  43.                     ]          
  44.                       
  45.                 }  
  46.             },  
  47.             {  
  48.                 "_index": "partsdb",  
  49.                 "_type": "_doc",  
  50.                 "_source": {  
  51.                     "PID": 946447,  
  52.                     "CID": 1006091,  
  53.   
  54.                       
  55.                     "Compliance": [  
  56.                         {  
  57.                             "RS": "Not Compliant",  
  58.                             "RV": "2019/863"  
  59.                               
  60.                         }  
  61.                     ],  
  62.                       
  63.                     
  64.                      
  65.                     "OtherQualification": [  
  66.                         {  
  67.                             "FN": "Calculated Failure Rate(FIT)",  
  68.                             "FV": "33.19",  
  69.                             "R": 293650962  
  70.                         },  
  71.                         {  
  72.                             "FN": "Confidence Level(UCL)",  
  73.                             "FV": "60%",  
  74.                             "R": 293650962  
  75.                         },  
  76.                         {  
  77.                             "FN": "Fails Quantity",  
  78.                             "FV": "0",  
  79.                             "R": 293650962  
  80.                         }  
  81.                     ]  
  82.                                      
  83.                 }  
  84.             },  
  85.  {  
  86.                 "_index": "partsdb",  
  87.                 "_type": "_doc",  
  88.                 "_source": {  
  89.                     "PID": 946451,  
  90.                     "CID": 1006091,  
  91.   
  92.                       
  93.                     "Compliance": [  
  94.                         {  
  95.                             "RS": "Not Compliant",  
  96.                             "RV": "2020/863"  
  97.   
  98.                               
  99.                         }  
  100.                     ],  
  101.                                       
  102.                     "OtherQualification": [  
  103.                         {  
  104.                             "FN": "Application",  
  105.                             "FV": "33.19",  
  106.                             "R": 293650259  
  107.                         },  
  108.                         {  
  109.                             "FN": "Confidence Level(UCL)",  
  110.                             "FV": "60%",  
  111.                             "R": 293650259  
  112.                         },  
  113.                         {  
  114.                             "FN": "Fails Quantity",  
  115.                             "FV": "0",  
  116.                             "R": 293650259  
  117.                         }  
  118.                           
  119.                     ]          
  120.                      
  121.                 }  
  122.  }  
  123.     ]  
  124.     }  
  125. }  
  126.               
 can you please help me

Answers (1)