Add JSON serializer

This is WIP and targets #355.
This scope is uneccesary.