When testing the patch for T91455, I noticed that the JSON output has duplicated all the numbered subkeys of the "params" item. This also occurs on the current TemplateData master.
Further investigation reveals that PHP is incredibly stupid when casting objects with integral keys to arrays: the array then has integral strings as keys, which can't be accessed via the [] operator (but do work with foreach), and assigning creates a new key with an integer key while leaving the integral-string key in place.
This was filed upstream as PHP bug 45959, where it was closed as "if we document it, then we can claim it's not a bug anymore". So we'd better work around the undesired behavior.