Fix pointer issue on json serialization.

There has to be a better way, i.e., reuse the channel map instead
of creating a new one each iteration.