Final working version.
Resulting dataset JSON. NEEDS CHECKING.