I have read that I can convert the ROOT file into a JSON using TBufferJSON. Is there a simple example do start with ?
Hi,
you cannot convert files but rather single objects which are not TTrees.
The operation is very easy: https://root.cern.ch/doc/master/classTBufferJSON.html#a2dd3ce085948fcee17114cdaf3325575
Cheers,
D
Hi,
In ROO5 docu there is simple example:
https://root.cern/root/html534/TBufferJSON.html
If you want to save result into text file, you can directly use method TBufferJSON::ExportToFile
https://root.cern.ch/doc/master/classTBufferJSON.html#a99af349993de8ed1a8736aba15faf4f1
This method used, when you call obj->SaveAs(“file.json”);
Regards,
Sergey
Great, exactly what I was looking for !
I am on ROOT v6.04, and couldn’t find TBufferJSON.h header file in the $ROOTSYS/include directory. Is it included by default during installation?
Hi,
For ROOT 6.04 you should enable compilation of http server.
With cmake:
cmake -Dhttp=ON
Regards,
Sergey
I have recompiled ROOT for JSON. Noticed that in my ROOT version, the ExportToFile is not available, checked the include file, didn’t find such a method obviously. Is it possible to write to a JSON file or I have to just write to a file manually ?
Hi,
If your ROOT version does not have TBufferJSON::ExportToFile function,
you need to create text file yourself.
Sorry, I somehow miss notification for this topic.
Regards,
Sergey
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.