Adding toJSON for file