How to add a field with custom method using JSON::Serializable

I don’t know if I’m working correctly with the Serializable but I have the follow example on github.

I would like to add a field for count unique_accounts. I want to count how many unique accounts I have.

Looking through my code on the Github Link how is the correct way to deal with it?

I have this class that too. However I think something is not well organized and being used in the correct way.

Create a separated file for the “serializer” and the properties is correct or should be done in a different way?

(Edit: changed links to permalinks)