Save data in a modified tree

How can I save the information of a modified tree in the json file?

Please, try to use the serialize() method of the data collection:

tree.data.serialize()

https://docs.dhtmlx.com/suite/data_collection__serialize.html