Selected items from clickData on icicle or treemap chart

If I want to get the current state of an icicle or treemap chart (probably sunburst works the same way too), it looks like I can use clickData, where the id variable gets me the path of labels, separated by / .

One nasty way this seems to fail is if there are any / characters in the data – they don’t get escaped in any way. Perhaps it would be better to provide the path as a list or dict in json format?

Or is there a more robust way to get the state? One easy (though kind of wasteful) thing to do would be to put in the customData the list of original indices corresponding to each node. Is there an easy way to accomplish this when creating the figure with plotly-express?