Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of `multiple=True` with nested args #29

dgilland opened this issue Dec 9, 2014 · 4 comments


Copy link

commented Dec 9, 2014

Correct me if I'm wrong, but it doesn't seem like nested args supports lists of dicts.

For example, using this:

args = {
    'collection': Arg({'foo': Arg(), 'bar': Arg()}, multiple=True)

to parse incoming data like this:

incoming = [
    {'foo': 1, 'bar': 2},
    {'foo': 3, 'bar': 4},
    {'foo': 5, 'bar': 6}

sloria added a commit that referenced this issue Dec 10, 2014


This comment has been minimized.

Copy link

commented Dec 10, 2014

multiple=True should work as expected with nested Args.

I've written a test case to verify this here:


This comment has been minimized.

Copy link

commented Dec 10, 2014

My usage was with how the various parsers process the args.

For example, if you look at flaskparser.parse_json, it passes arg.multiple to core.get_value. Then in core.get_value, this line gets hit which wraps the JSON data value in a list.

So instead of receiving [{...}, {...}], the value is passed as [[{...}, {...}]] which then fails validation check.

@sloria sloria closed this in 8eb0572 Dec 12, 2014


This comment has been minimized.

Copy link

commented Dec 12, 2014

Hotfix is in the latest release on the PyPI. Thanks for reporting this!


This comment has been minimized.

Copy link

commented Aug 8, 2016

For newer versions many works:

    'col': fields.Nested({
        'foo': fields.Str(),
        'bar': fields.Str(),
    }, many=True)
curl -d '{"col": [{"foo": "1"}, {"bar": "2"}]}'  -X POST -H 'content-type: application/json' http://server/route 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.