added to_json function to models