In modeling pipeline, store mapping/encoders with instance attributes or JSON?

Basically i built a data pipeline for classification and it combines the preprocessor pipeline and modeling two parts. since i need to persist the encoders and mapping rules in the training process for the purpose of using the same mapping in testing or production.

so in the preprocess module, i basically wrote my own custom estimator derived from sklearn, and i saved the encoders and other mapping rules to its attribute(instance). and use the same estimator(instance) to apply on new data.

Meanwhile i can also save the encoders and mapping rules to JSON and load it before applying on new datasets...

I was trying to search online for their pros and cons. Does anyone know the link of the details or can explain a bit more about them?