sloria/marshmallow — pull request #38 by ecarreras (2014-08-13 11:51:40+00:00)
Title: Encapsulate data

Add a feature for encapsulate data in the JSON and generate a JSON with ember compatibility. The key of encapsulate is pluralized automatically if is used with `many=True`.

```python
user1 = User(name="Mick", email="mick@stones.com")
user2 = User(name="Keith", email="keith@stones.com")
users = [user1, user2]
serializer = UserSerializer(many=True, encapsulate='user')
results, errors = serializer.dump(users)
# {'users': [
# {'created_at': 'Fri, 08 Nov 2013 17:02:17 -0000',
# 'email': u'mick@stones.com',
# 'name': u'Mick'},
# {'created_at': 'Fri, 08 Nov 2013 17:02:17 -0000',
# 'email': u'keith@stones.com',
# 'name': u'Keith'}]}
```

I don't know if the name `encapsulate` is right or if you will like this feature. If is accepted then I'll write the documentation.

And the examples can be changed to use this feature.