Rendering improper layers order

In Tiled, I have a mix of tile layer and object layers. Some of my tile layers are placed visually over object layers (so they should render over the objects), but when I load the map in Phaser, all tile layers get rendered first, and then all object layers get rendered on top, regardless of their order in Tiled.

Expected order:

Parsed:

I think phaser is render first the layers and after the objects.

Currently i made a json where I place an array with all layers/objects order and after map parsing I am setting depth based on the array index, but in future with lot of layers it would be hard to maintain.

Phaser renders tile layers only. If you use createFromObjects() then the new game objects are added to the end of the display list. But you can move them somewhere else or change their depth.

Yes, finally I just assigned zindex to custom properties for each layer and objects.