Programatically create a Neo block with children I already discovered how to create a neo block programmatically from this post: How can I set a Neo field&#39;s values from my plugin/module?
However, I don't know how I can create a neo block with child blocks.
So the idea is I want something like this:
[
    'blocks' =&gt; [ // Neo field handle
        'new0' =&gt; [
            'modified' =&gt; 1,
            'type' =&gt; 'topLevel', // Top level neo block
            'enabled' =&gt; 1,
            'collapsed' =&gt; 0,
            'level' =&gt; 0,
            'fields' =&gt; [
                'someField' =&gt; true, // Neo block field
            ],
            'children' =&gt; [
                'new0' =&gt; [
                    'modified' =&gt; 1,
                    'type' =&gt; 'secondLevel', // child neo block
                    'enabled' =&gt; 1,
                    'collapsed' =&gt; 0,
                    'level' =&gt; 0,
                ]
            ]
        ]
    ]
]

The children array is just what I imagine the solution might be like. But this doesn't work.
Does anybody know how it should be done?
Thanks
I figured it out. You have to create a separate block and it somehow figures out it's a child based on the level you specify. So something like this:
[
    'new1' = [
        'modified' =&gt; 1,
        'type' =&gt; 'parentBlock',
        'enabled' =&gt; 1,
        'collapsed' =&gt; 0,
        'level' =&gt; 0,
        'fields' =&gt; [
            'theme' =&gt; 'black',
        ],
    ],
    'new2'= [
        'modified' =&gt; 1,
        'type' =&gt; 'childBlock',
        'enabled' =&gt; 1,
        'collapsed' =&gt; 0,
        'level' =&gt; 1, // increment the level
        'fields' =&gt; [
            'value' =&gt; 'text',
        ],
    ]
]