Error restoring TStyle from json

Hi ROOT-Team,

I found an error trying to restore an instance of TStyle using TBufferJSON::FromJSON.
Here a small reproducer:

TStyle s;
std::string str(TBufferJSON::ToJSON(&s));
TStyle* restore = nullptr;
TBufferJSON::FromJSON(restore, str.c_str());

ROOT fails with:

Error in <TRint::HandleTermInput()>: nlohmann::detail::type_error caught: [json.exception.type_error.302] type must be number, but is array

The error seems to come from the attribute fLineStyle.


ROOT Version: 6.24.00 (/cvmfs/
Platform: lxplus (CentOS Linux release 7.9.2009)
Compiler: gcc48

Hi Lukas,

I will try to check problem begin of next week.



I can reproduce the problem.

There are two data members in TStyle object with fLineStyle name.
This cannot work with JSON where unique names for all data members are required.
We will try to fix TStyle class design.


Thanks Sergey!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.