# VTK json

**URL:** https://discourse.vtk.org/t/vtk-json/16282
**Category:** Development
**Tags:** code
**Created:** [February 10, 2026, 2:54pm UTC](https://discourse.vtk.org/t/vtk-json/16282 "2026-02-10T14:54:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Francois\_Merle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/francois_merle/32/9872_2.png) [@Francois\_Merle](https://discourse.vtk.org/u/Francois_Merle)
#### Post date: [February 10, 2026, 2:54pm UTC](https://discourse.vtk.org/t/vtk-json/16282/1 "2026-02-10T14:54:50Z")

</div>

Hello,

I am using VTK together with the Drogon C++ web framework.  
Drogon depends on the system jsoncpp library, while VTK ships its own  
vendored copy of jsoncpp under vtkjsoncpp (namespace vtkJson).

When both libraries are included in the same translation unit, I get  
redefinition errors at compile time, for example:

```bash
In file included from /usr/local/include/drogon/plugins/SlashRemover.h:18,
                 from /usr/local/include/drogon/drogon.h:34,
                 from /home/site/merle/Projects/planet-sandbox/server/prototype_patients/patient_service/main.cc:3:
/usr/include/json/value.h:67:16: error: redefinition of 'class vtkJson::Exception'
   67 | class JSON_API Exception : public std::exception {
      | ^ ~~~~~~~~
In file included from /usr/local/include/drogon/HttpRequest.h:24,
                 from /usr/local/include/drogon/HttpBinder.h:25,
                 from /usr/local/include/drogon/HttpAppFramework.h:23,
                 from /usr/local/include/drogon/drogon.h:23,
                 from /home/site/merle/Projects/planet-sandbox/server/prototype_patients/patient_service/main.cc:3:
/usr/local/vtk-9.5.2-native/include/vtk-9.6/vtkjsoncpp/json/json.h:610:16: note: previous definition of 'class vtkJson::Exception'
  610 | class JSON_API Exception : public std::exception {
      | ^ ~~~~~~~~

In file included from /usr/local/include/drogon/plugins/SlashRemover.h:18,
                 from /usr/local/include/drogon/drogon.h:34,
                 from /home/site/merle/Projects/planet-sandbox/server/prototype_patients/patient_service/main.cc:3:
/usr/include/json/value.h:83:16: error: redefinition of 'class vtkJson::RuntimeError'
   83 | class JSON_API RuntimeError : public Exception {
      | ^ ~~~~~~~~~~~
In file included from /usr/local/include/drogon/HttpRequest.h:24,
                 from /usr/local/include/drogon/HttpBinder.h:25,
                 from /usr/local/include/drogon/HttpAppFramework.h:23,
                 from /usr/local/include/drogon/drogon.h:23,
                 from /home/site/merle/Projects/planet-sandbox/server/prototype_patients/patient_service/main.cc:3:
/usr/local/vtk-9.5.2-native/include/vtk-9.6/vtkjsoncpp/json/json.h:629:16: note: previous definition of 'class vtkJson::RuntimeError'
  629 | class JSON_API RuntimeError : public Exception {

```

So I am wondering whether it would be better to rename the vtkJson namespace  
directly instead of using a #define ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [February 11, 2026, 5:25am UTC](https://discourse.vtk.org/t/vtk-json/16282/2 "2026-02-11T05:25:10Z")

</div>

That makes more difficult to update (as we’re bound to miss instances when updating).

Alas, we do use it publicly, so perhaps some way to not conflict is possible…but why not compile VTK to use the same `jsoncpp` rather than using its vendored copy instead?

---

<div class="post-metadata">

### Author: ![Francois\_Merle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/francois_merle/32/9872_2.png) [@Francois\_Merle](https://discourse.vtk.org/u/Francois_Merle)
#### Post date: [February 11, 2026, 10:37am UTC](https://discourse.vtk.org/t/vtk-json/16282/3 "2026-02-11T10:37:00Z")

</div>

Yes, you are right. I wasn’t sure whether using the system json would introduce others issues but building VTK with -DVTK\_MODULE\_USE\_EXTERNAL\_VTK\_jsoncpp=YES solved my problem, and the project now compiles without conflicts.
