function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raju Krishnamoorthy 17Raju Krishnamoorthy 17 

Showing JSON response in LWC

Hello LWC gurus: please help.
I'm calling out a REST service that returns a JSON response that contains a Parent-Child relationship.  For example, response contains 10 Sales Orders, each Sales Order can upto 100+ Order lines.   I want to show the Orders in LWC as HTML table, and when the user clicks on one particular Order (row action?!), all the Order Lines of that Order should be displayed.  What is the best approach from LWC perspective? If you can point to some example code that would be of great help. Thank you.
 
VinayVinay (Salesforce Developers) 
Hi Raju,

Review below examples which can help you with your implementation.

https://www.salesforcecodecrack.com/2019/08/make-rest-api-callout-in-lwc.html
https://www.sfdcstop.com/2019/01/salesforce-lightning-tutorial-part-6.html

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Raju Krishnamoorthy 17Raju Krishnamoorthy 17
Thank you, Vinay.  But, on the UI, (LWC or Aura), I need to show the related data only when the user clicks 'View Details' on a particular order.  On the LWC, how can we show only when the user specifically clicks on the View button.