codecs/collectdjson: rework handling of the data

  * No more double loops
  * Use the dsnames variable for naming