title: how to export jstree desired json formatted from controller laravel
body: <p>I am using jstree jQuery plugin to display Categories as tree view.</p>
  <p>the data array from controller :</p>
  <pre><code>array:10 [
   0 =&gt; array:13 [
  &quot;id&quot; =&gt; 1
  &quot;name&quot; =&gt; &quot;Request 1&quot;
  &quot;content&quot; =&gt; &quot;Request content 1&quot;
  &quot;type&quot; =&gt; 1
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; array:5 [
    0 =&gt; array:13 [
      &quot;id&quot; =&gt; 1
      &quot;name&quot; =&gt; &quot;Problem 1 (Request 1)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 1 (Request 1)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;request_id&quot; =&gt; 1
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; array:5 [
        0 =&gt; array:12 [
          &quot;id&quot; =&gt; 1
          &quot;name&quot; =&gt; &quot;Solution 1 (Problem 1)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 1 (Problem 1)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 1
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        1 =&gt; array:12 [
          &quot;id&quot; =&gt; 2
          &quot;name&quot; =&gt; &quot;Solution 2 (Problem 1)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 2 (Problem 1)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 1
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        2 =&gt; array:12 [
          &quot;id&quot; =&gt; 3
          &quot;name&quot; =&gt; &quot;Solution 3 (Problem 1)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 3 (Problem 1)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 1
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        3 =&gt; array:12 [
          &quot;id&quot; =&gt; 4
          &quot;name&quot; =&gt; &quot;Solution 4 (Problem 1)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 4 (Problem 1)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 1
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        4 =&gt; array:12 [
          &quot;id&quot; =&gt; 5
          &quot;name&quot; =&gt; &quot;Solution 5 (Problem 1)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 5 (Problem 1)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 1
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
      ]
    ]
    1 =&gt; array:13 [
      &quot;id&quot; =&gt; 2
      &quot;name&quot; =&gt; &quot;Problem 2 (Request 1)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 2 (Request 1)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;request_id&quot; =&gt; 1
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; array:5 [
        0 =&gt; array:12 [
          &quot;id&quot; =&gt; 6
          &quot;name&quot; =&gt; &quot;Solution 1 (Problem 2)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 1 (Problem 2)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 2
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        1 =&gt; array:12 [
          &quot;id&quot; =&gt; 7
          &quot;name&quot; =&gt; &quot;Solution 2 (Problem 2)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 2 (Problem 2)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 2
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        2 =&gt; array:12 [
          &quot;id&quot; =&gt; 8
          &quot;name&quot; =&gt; &quot;Solution 3 (Problem 2)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 3 (Problem 2)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 2
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        3 =&gt; array:12 [
          &quot;id&quot; =&gt; 9
          &quot;name&quot; =&gt; &quot;Solution 4 (Problem 2)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 4 (Problem 2)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 2
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
        4 =&gt; array:12 [
          &quot;id&quot; =&gt; 10
          &quot;name&quot; =&gt; &quot;Solution 5 (Problem 2)&quot;
          &quot;content&quot; =&gt; &quot;Solution content 5 (Problem 2)&quot;
          &quot;priority&quot; =&gt; 1
          &quot;is_active&quot; =&gt; 1
          &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
          &quot;problem_id&quot; =&gt; 2
          &quot;created_user_id&quot; =&gt; 1
          &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
          &quot;updated_user_id&quot; =&gt; null
          &quot;updated_user_name&quot; =&gt; null
        ]
      ]
    ]
    2 =&gt; array:13 [
      &quot;id&quot; =&gt; 3
      &quot;name&quot; =&gt; &quot;Problem 3 (Request 1)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 3 (Request 1)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;request_id&quot; =&gt; 1
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    3 =&gt; array:13 [
      &quot;id&quot; =&gt; 4
      &quot;name&quot; =&gt; &quot;Problem 4 (Request 1)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 4 (Request 1)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;request_id&quot; =&gt; 1
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    4 =&gt; array:13 [
      &quot;id&quot; =&gt; 5
      &quot;name&quot; =&gt; &quot;Problem 5 (Request 1)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 5 (Request 1)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
      &quot;request_id&quot; =&gt; 1
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
  ]
    ]
    1 =&gt; array:13 [
  &quot;id&quot; =&gt; 2
  &quot;name&quot; =&gt; &quot;Request 2&quot;
  &quot;content&quot; =&gt; &quot;Request content 2&quot;
  &quot;type&quot; =&gt; 1
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; array:5 [
    0 =&gt; array:13 [
      &quot;id&quot; =&gt; 6
      &quot;name&quot; =&gt; &quot;Problem 1 (Request 2)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 1 (Request 2)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;request_id&quot; =&gt; 2
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    1 =&gt; array:13 [
      &quot;id&quot; =&gt; 7
      &quot;name&quot; =&gt; &quot;Problem 2 (Request 2)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 2 (Request 2)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;request_id&quot; =&gt; 2
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    2 =&gt; array:13 [
      &quot;id&quot; =&gt; 8
      &quot;name&quot; =&gt; &quot;Problem 3 (Request 2)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 3 (Request 2)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;request_id&quot; =&gt; 2
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    3 =&gt; array:13 [
      &quot;id&quot; =&gt; 9
      &quot;name&quot; =&gt; &quot;Problem 4 (Request 2)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 4 (Request 2)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;request_id&quot; =&gt; 2
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
    4 =&gt; array:13 [
      &quot;id&quot; =&gt; 10
      &quot;name&quot; =&gt; &quot;Problem 5 (Request 2)&quot;
      &quot;content&quot; =&gt; &quot;Problem content 5 (Request 2)&quot;
      &quot;priority&quot; =&gt; 1
      &quot;is_active&quot; =&gt; 1
      &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:04.000000Z&quot;
      &quot;request_id&quot; =&gt; 2
      &quot;created_user_id&quot; =&gt; 1
      &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
      &quot;updated_user_id&quot; =&gt; null
      &quot;updated_user_name&quot; =&gt; null
      &quot;solutions&quot; =&gt; []
    ]
  ]
    ]
    2 =&gt; array:13 [
  &quot;id&quot; =&gt; 3
  &quot;name&quot; =&gt; &quot;Request 3&quot;
  &quot;content&quot; =&gt; &quot;Request content 3&quot;
  &quot;type&quot; =&gt; 2
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    3 =&gt; array:13 [
  &quot;id&quot; =&gt; 4
  &quot;name&quot; =&gt; &quot;Request 4&quot;
  &quot;content&quot; =&gt; &quot;Request content 4&quot;
  &quot;type&quot; =&gt; 1
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    4 =&gt; array:13 [
  &quot;id&quot; =&gt; 5
  &quot;name&quot; =&gt; &quot;Request 5&quot;
  &quot;content&quot; =&gt; &quot;Request content 5&quot;
  &quot;type&quot; =&gt; 1
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    5 =&gt; array:13 [
  &quot;id&quot; =&gt; 6
  &quot;name&quot; =&gt; &quot;Request 6&quot;
  &quot;content&quot; =&gt; &quot;Request content 6&quot;
  &quot;type&quot; =&gt; 2
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    6 =&gt; array:13 [
  &quot;id&quot; =&gt; 7
  &quot;name&quot; =&gt; &quot;Request 7&quot;
  &quot;content&quot; =&gt; &quot;Request content 7&quot;
  &quot;type&quot; =&gt; 1
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    7 =&gt; array:13 [
  &quot;id&quot; =&gt; 8
  &quot;name&quot; =&gt; &quot;Request 8&quot;
  &quot;content&quot; =&gt; &quot;Request content 8&quot;
  &quot;type&quot; =&gt; 2
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    8 =&gt; array:13 [
  &quot;id&quot; =&gt; 9
  &quot;name&quot; =&gt; &quot;Request 9&quot;
  &quot;content&quot; =&gt; &quot;Request content 9&quot;
  &quot;type&quot; =&gt; 2
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
    ]
    9 =&gt; array:13 [
  &quot;id&quot; =&gt; 10
  &quot;name&quot; =&gt; &quot;Request 10&quot;
  &quot;content&quot; =&gt; &quot;Request content 10&quot;
  &quot;type&quot; =&gt; 2
  &quot;priority&quot; =&gt; 1
  &quot;is_active&quot; =&gt; 1
  &quot;created_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;updated_at&quot; =&gt; &quot;2021-10-21T12:12:03.000000Z&quot;
  &quot;created_user_id&quot; =&gt; 1
  &quot;created_user_name&quot; =&gt; &quot;Truong Nguyen&quot;
  &quot;updated_user_id&quot; =&gt; null
  &quot;updated_user_name&quot; =&gt; null
  &quot;problems&quot; =&gt; []
  </code></pre>
  <p>]
  ]</p>
  <p>While on other hand , JStree plugin is desired a json format like to create treeview from it :</p>
  <pre><code>  {
                                  &quot;text&quot;: &quot;Information&quot;,
                                  &quot;state&quot;: {
                                      &quot;opened&quot;: true,
                                      &quot;disabled&quot;: true
                                  },
                                  &quot;type&quot;: &quot;wrap&quot;,
                                  &quot;children&quot;: [
                                      {
                                          &quot;text&quot;: &quot;Request 1&quot;,
                                          &quot;type&quot;: &quot;request&quot;,
                                          &quot;children&quot;: [
                                              {
                                                  &quot;text&quot;: &quot;Problem 1 (Request 1)&quot;,
                                                  &quot;type&quot;: &quot;problem&quot;,
                                                  &quot;children&quot;: [
                                                      {
                                                          &quot;text&quot;: &quot;Solution 1 (Problem 1)&quot;,
                                                          &quot;children&quot;: [],
                                                          &quot;id&quot;: &quot;1-3&quot;,
                                                          &quot;icon&quot;: &quot;folder&quot;
                                                      }
                                                  ],
                                                  &quot;id&quot;: &quot;New node 2&quot;,
                                              },
                                              {
                                                  &quot;text&quot;: &quot;Problem 2 (Request 1)&quot;,
                                                  &quot;children&quot;: [
                                                      {
                                                          &quot;text&quot;: &quot;Solution 1 (Problem 2)&quot;,
                                                          &quot;children&quot;: [],
                                                          &quot;id&quot;: &quot;1-3&quot;,
                                                          &quot;icon&quot;: &quot;folder&quot;
                                                      }
                                                  ],
                                                  &quot;id&quot;: &quot;requestId-problemId-Solution&quot;,
                                                  &quot;icon&quot;: &quot;folder&quot;
                                              }
                                          ],
                                      },
                                      {
                                          &quot;text&quot;: &quot;Request 2&quot;,
                                          &quot;type&quot;: &quot;request&quot;,
  
                                          &quot;children&quot;: [
                                              {
                                                  &quot;text&quot;: &quot;Problem 1 (Request 2)&quot;,
                                                  &quot;icon&quot;: &quot;folder&quot;,
                                                  
                                              },
                                              {
                                                  &quot;text&quot;: &quot;ádasdasd&quot;,
                                                  &quot;children&quot;: [
                                                      {
                                                          &quot;text&quot;: &quot;ádf&quot;,
                                                          &quot;children&quot;: [],
                                                          &quot;icon&quot;: &quot;folder&quot;
                                                      }
                                                  ],
                                                  &quot;icon&quot;: &quot;folder&quot;
                                              },
                                              {
                                                  &quot;text&quot;: &quot;many&quot;,
                                                  &quot;children&quot;: [],
                                                  &quot;icon&quot;: &quot;folder&quot;
                                              }
                                          ],
                                      }
                                  ]
                              }
  </code></pre>
  <p>How can i convert return format of data array from laravel controller  to Appropriate format that jstree is desired ?</p>