libc++abi: terminating with uncaught exception of type cling::InvalidDerefException: Trying to access a pointer that points to an invalid memory address.
I do not know if it is relevant, but when trying to include nlohmann-json I first tried with: #include "nlohmann/json.hpp"
But root did not recognize it, so I had to install the library separately and write the full path to the library location.
That lines adds a security: if the file name is incorrect or not found, it will exit instead of crashing. So you have to fix the filename or path so that it finds it correctly.
I have tried to run this very same code on another laptop and it does work, so I guess it might be related to the ROOT installation. By the way, I am not allowed to modified the original post anymore, but there is a mistake with the ROOT version, it is 6.26/06.