[WIP] Add JSON output

This PR adds JSON formatted output. It is not ready yet.