Maybe do the same `map` and remove multiple `if json_mode` checks here too. Not a big deal though.