adding functionality to convert components to JSON