Move JSON handling into utils

This allows for every copied file to get added to the JSON output.

Change-Id: I588c173056d359d514e2c1715837b5ce4bf71cb0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>