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.

Thanks,
Lukas

ROOT Version: 6.24.00 (/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.00/x86_64-centos7-gcc48-opt/)
Platform: lxplus (CentOS Linux release 7.9.2009)
Compiler: gcc48


Hi Lukas,

I will try to check problem begin of next week.

Regards,
Sergey

Hi,

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.

Regards,
Sergey

Thanks Sergey!

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