Provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with JSON. Think of this as a view layer for your JSON/YAML/etc. Based on https://fractal.thephpleague.com/
$ pip install fractal_output
from fractal_output import Manager, Transformer, Item
class UserTransformer(Transformer):
def transform(self, user):
return {
'id': user.id,
'firstName': user.first_name
}
user = YourUserClass()
transformer = UserTransformer()
item = Item(user, transformer)
manager = Manager()
manager.create_data(item).to_json()