[
@foreach($elements as $element)
    [
        'title' => '{{ $element->title }}',
        'slug' => '{{ $element->slug }}',
        'category' => '{{ $element->category }}',
        'ui_component' => '{{ $element->ui_component }}',
        'icon' => '{{ $element->icon }}',
        'data' => '{!! json_encode($element['data'] ?? []) !!}',
        'fields' => [
            @foreach($element->fields as $field)
            [
                'field_type' => '{{ $field->field_type }}',
                'name' => '{{ $field->name }}',
                'slug' => '{{ $field->slug }}',
                @if($field->child_element_id)'child_element_id' => '{{ $field->childElement->slug }}',
@endif
                'data' => '{!! json_encode($field->data) !!}',
                'meta' => '{!! json_encode($field->meta) !!}',
            ],
            @endforeach
        ],
    ],
@endforeach
]
