this works a lot better than the very bad dump function I had before. The output isn't pretty printed but can easily be made so by piping it to jq, for example.