The following query wraps JSON from a derived table in more JSON:
This results in undesirable output:
It doesn't happen with scalar subqueries:
Or with the usual laborious workaround for such problems:
Both resulting in the expected output
For comparison, MySQL 8.0.22 doesn't behave this way.