1

Sample JSON below

[
   {
      "OrderNumber": 12345,
      "OrderLineReference": "190828-11-VWT-5653090001001",
      "Addition": "0,00",
      "Axis": 60,
      "Cylinder": 100,
      "Eye": "Right",
      "Sphere": "123",
      "Quantity": 1,
      "Product": "466772 P. UF1.5 UV SOL N3 / 146772",
      "Supplements": "663 Digipack- - -"
   },
   {
      "OrderNumber": 12345,
      "OrderLineReference": "190828-11-VWT-5653090001002",
      "Addition": "0,00",
      "Axis": -1,
      "Cylinder": "0",
      "Eye": "Left",
      "Sphere": "111",
      "Quantity": 1,
      "Product": "466772 P. UF1.5 UV SOL N3 / 146772",
      "Supplements": "663 Digipack- - -"
   },
   {
      "OrderNumber": 12345,
      "OrderLineReference": "190828-11-VWT-5653090001F001",
      "Product": "OWIS095 C01 BLACK 55x18x140"
   }
]

I have a search component that searches for a JSON. Is it possible to search by specific value? Ex. I'll search for a sphere with the value '111' then it will display only Sphere with value '111'?

Thank you all.

  • Few questions Are, Is this data comes from outside from Salesforce, If this data present in salesforce, I think you should go with SOQL with where condition. else you are already building component So you should do search functionality at the client-side mean in component JS. – Sarvesh Sep 19 at 7:28
  • Hi Sarvesh this is a text field and we're converting the text to JSON. – Atoc Sep 19 at 8:48
2

Yes.

Parse the JSON using one of these JSON methods. (One way to do that is via the code generated by https://json2apex.herokuapp.com/.) Then loop over the items checking the Sphere value.

  • thank you kind sir. – Atoc Sep 19 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.