Venkat Kumar

Venkat Kumar

  • NA
  • 503
  • 143.1k

How to Filter JSON data using Jquery

Apr 26 2018 4:20 AM
Here is my complete JSON data
  1.  {    
  2.       "results":    
  3.      [    
  4.        {    
  5.          "Model Name""abc",    
  6.          "Desc""EmployeesPublic Access",    
  7.          "Doc": [],    
  8.          "Model":    
  9.          [    
  10.                {    
  11.                    "Name""Voltage",    
  12.                    "ValueOption": []    
  13.                },    
  14.                {    
  15.                    "Name""Fan Speed",    
  16.                    "ValueOption":    
  17.                  [    
  18.                        {    
  19.                            "Id""aMa0R0000004CD0SAM",    
  20.                            "Name""1000"    
  21.                        }    
  22.                  ]    
  23.                }    
  24.     
  25.          ]    
  26.        },    
  27.        {    
  28.          "Model Name""def",    
  29.          "Desc""Employees Public Access",    
  30.          "Doc": [],    
  31.          "Model":     
  32.     [    
  33.              {    
  34.                  "Name""Parts",    
  35.                  "ValueOption": []    
  36.              },    
  37.              {    
  38.                  "Name""Metal",    
  39.                  "ValueOption":     
  40.         [    
  41.                      {    
  42.                          "Id""aMa0R000000001XSAQ",    
  43.                          "Name""Indes"    
  44.                      }    
  45.                  ]    
  46.              }    
  47.     
  48.     
  49.          ]    
  50.       }    
  51.      ]    
  52.     
  53.  }    
Now If i pass the Id=aMa0R0000004CD0SAM(Highlighted above as well) then I have to get result that contains that Id like below(JSON format only)
  1. [  
  2. {    
  3.          "Model Name""abc",    
  4.          "Desc""EmployeesPublic Access",    
  5.          "Doc": [],    
  6.          "Model":    
  7.          [    
  8.                {    
  9.                    "Name""Voltage",    
  10.                    "ValueOption": []    
  11.                },    
  12.                {    
  13.                    "Name""Fan Speed",    
  14.                    "ValueOption":    
  15.                  [    
  16.                        {    
  17.                            "Id""aMa0R0000004CD0SAM",    
  18.                            "Name""1000"    
  19.                        }    
  20.                  ]    
  21.                }    
  22.     
  23.          ]    
  24.        }  
  25. ]   
Can someone help me how to acheive above result?

Answers (1)