Saturday, April 29, 2017

JsonCpp debug helper for Visual Studio

JsonCpp internally uses maps and pointers so debugging of a code even with a small JSON is tedious. You have to expand too many nodes to get some value.

Fortunately, Visual Studio debugger supports type visualizers, which are easy to make. So I've created one for perfect JsonCpp structures visualization and published it on github:

Technically it is an XML file with special rules for the debugger, which instructs it how to represent Json::Value data.

Custom visualizers format for Visual Studio called Natvis and if you check Visual Studio installation directory you'll find some *.natvis files there, e.g. stl.natvis. So Visual Studio uses the same approach to visualize STL types.

Microsoft prepared a good article for these who want to make own custom type visualizer:

It describes all aspects, including creation, deployment and debugging of Natvis files.

I hope, my visualizer will be helpful for somebody else.

No comments: