Added toJSON on entities.