title: how to json data to be inserted in accordion in react js
body: <pre><code>{
     "message": "",
     "data": [{
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 18,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Workshop Expenses",
             "amount": 1086332.17,
             "group": "Admin Expenses",
             "subgroup_id": 2112
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 1,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Administrative Expenses",
             "amount": 818896.55,
             "group": "Admin Expenses",
             "subgroup_id": 2113
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 3997,
             "subgroup_seq": 2,
             "group_seq": 4,
             "rootgroup_id": 4,
             "subgroup": "Employee Benifits",
             "amount": 12535362.01,
             "group": "Staff costs",
             "subgroup_id": 2114
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 3,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Communication Expenses",
             "amount": 178568.81,
             "group": "Admin Expenses",
             "subgroup_id": 2116
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 4,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Freight &amp; Cartage",
             "amount": 82206.01,
             "group": "Admin Expenses",
             "subgroup_id": 2117
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 3997,
             "subgroup_seq": 6,
             "group_seq": 4,
             "rootgroup_id": 4,
             "subgroup": "Staff Welfare",
             "amount": 439714.02,
             "group": "Staff costs",
             "subgroup_id": 2118
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4065,
             "subgroup_seq": 8,
             "group_seq": 16,
             "rootgroup_id": 4,
             "subgroup": "Interest Paid",
             "amount": 5019919.0,
             "group": "Finance Cost",
             "subgroup_id": 2120
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4067,
             "subgroup_seq": 1,
             "group_seq": 1,
             "rootgroup_id": 4,
             "subgroup": "Purchase of Cars",
             "amount": 395535346.61,
             "group": "PURCHASE ACCOUNTS",
             "subgroup_id": 2121
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4067,
             "subgroup_seq": 2,
             "group_seq": 1,
             "rootgroup_id": 4,
             "subgroup": "Purchase of Spares",
             "amount": 38558778.38,
             "group": "PURCHASE ACCOUNTS",
             "subgroup_id": 2122
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4083,
             "subgroup_seq": 2,
             "group_seq": 2,
             "rootgroup_id": 3,
             "subgroup": "Insurance Commission",
             "amount": -579371.89,
             "group": "Sale of Services",
             "subgroup_id": 2125
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4070,
             "subgroup_seq": 4,
             "group_seq": 1,
             "rootgroup_id": 3,
             "subgroup": "Parts Sale",
             "amount": -37622615.91,
             "group": "Sales Accounts",
             "subgroup_id": 2126
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4083,
             "subgroup_seq": 1,
             "group_seq": 2,
             "rootgroup_id": 3,
             "subgroup": "Labour Sales",
             "amount": -9740952.02,
             "group": "Sale of Services",
             "subgroup_id": 2127
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 2999,
             "subgroup_seq": 2,
             "group_seq": 4,
             "rootgroup_id": 3,
             "subgroup": "Misc Sales Accounts",
             "amount": -2983666.52,
             "group": "Other Income",
             "subgroup_id": 2128
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4070,
             "subgroup_seq": 2,
             "group_seq": 1,
             "rootgroup_id": 3,
             "subgroup": "New Vehicle Sales",
             "amount": -439036264.75,
             "group": "Sales Accounts",
             "subgroup_id": 2129
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4070,
             "subgroup_seq": 7,
             "group_seq": 1,
             "rootgroup_id": 3,
             "subgroup": "Parts &amp; Accessories",
             "amount": -1841715.3,
             "group": "Sales Accounts",
             "subgroup_id": 2156
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 5,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Travelling Expenses",
             "amount": 840058.39,
             "group": "Admin Expenses",
             "subgroup_id": 2164
         },
         {
             "root": "Income",
             "root_seq": 3,
             "group_id": 4083,
             "subgroup_seq": 3,
             "group_seq": 2,
             "rootgroup_id": 3,
             "subgroup": "Finance Commissions",
             "amount": -2585756.65,
             "group": "Sale of Services",
             "subgroup_id": 2179
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 6,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Bank Chgs",
             "amount": 84670.98,
             "group": "Admin Expenses",
             "subgroup_id": 2181
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 7,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Subscriptions",
             "amount": 14875.0,
             "group": "Admin Expenses",
             "subgroup_id": 2183
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 10,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Repairs &amp; Maintenance",
             "amount": 19516.52,
             "group": "Admin Expenses",
             "subgroup_id": 2184
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 11,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Selling Expenses",
             "amount": 1877129.65,
             "group": "Admin Expenses",
             "subgroup_id": 2185
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 3997,
             "subgroup_seq": 7,
             "group_seq": 4,
             "rootgroup_id": 4,
             "subgroup": "PF &amp; ESI Contribution",
             "amount": 479154.0,
             "group": "Staff costs",
             "subgroup_id": 2186
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 13,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Printing &amp; Stationery",
             "amount": 341302.0,
             "group": "Admin Expenses",
             "subgroup_id": 2188
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 14,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Professional &amp; Consultancy",
             "amount": 677796.0,
             "group": "Admin Expenses",
             "subgroup_id": 2189
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 15,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Taxes &amp; Licenses",
             "amount": 20000.0,
             "group": "Admin Expenses",
             "subgroup_id": 2190
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 16,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Electricity Expenses",
             "amount": 662833.96,
             "group": "Admin Expenses",
             "subgroup_id": 2191
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 17,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Rents",
             "amount": 5503688.0,
             "group": "Admin Expenses",
             "subgroup_id": 2192
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 8,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Repairs &amp; Maintenance - Buildings",
             "amount": 141850.0,
             "group": "Admin Expenses",
             "subgroup_id": 2193
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4000,
             "subgroup_seq": 9,
             "group_seq": 5,
             "rootgroup_id": 4,
             "subgroup": "Repairs &amp; Maintenance - P&amp;M",
             "amount": 84813.23,
             "group": "Admin Expenses",
             "subgroup_id": 2194
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4065,
             "subgroup_seq": 10,
             "group_seq": 16,
             "rootgroup_id": 4,
             "subgroup": "Interest paid to Others",
             "amount": 972877.66,
             "group": "Finance Cost",
             "subgroup_id": 2196
         },
         {
             "root": "Expenditure",
             "root_seq": 4,
             "group_id": 4065,
             "subgroup_seq": 11,
             "group_seq": 16,
             "rootgroup_id": 4,
             "subgroup": "Other Borrowing Costs",
             "amount": 327500.0,
             "group": "Finance Cost",
             "subgroup_id": 2197
         }
     ]
  }
  </code></pre>
  
  <p>Hi, I just want the above JSON to be react accordion, the structure would be <strong>root</strong> name under that <strong>group</strong> under <strong>group</strong> name to show <strong>subgroup</strong> this will be handled by <strong>group_id</strong>. if anyone helps me it means a lot.</p>
  
  <p>I want the data to be shown as in the image</p>
  
  <p><a href="https://i.stack.imgur.com/V8s6a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V8s6a.png" alt="enter image description here"></a></p>