In the cargo 1.12 we can use `--message-format=json` option to get messages in the json format: https://github.com/rust-lang/cargo/pull/3000 It affects bench, build, doc, run, rustc, rustdoc, test. Docs: https://github.com/rust-lang/cargo/blob/master/src/doc/machine-readable-output.md