How to save hyperparameters as json in logs?

I have a dictionary of hyperparameters, something like:
hparams = {"lr":1.e-3, "loss":"L2", "hidden_channels": 128}
I’m using Tensorboard as logger and the ModelCheckpoint as callback for the checkpoints. How can I save a json file or similar with the info of the hyperparameters in the logs folder together with the checkpoints?
Thanks in advance

I found it. In the init inside the Lightning.LightningModule, just write self.save_hyperparameters(hparams).