Split main.json

Fixes #2582, #2572 and splits the main.json file into many others.

@paglias could you check this please?