{"action":"opened","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3598","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3598/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3598/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3598/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3598","id":115155311,"number":3598,"title":"Serializer validation. Issue with parsing dictionary if array is a value","user":{"login":"akolpakov","id":1101455,"avatar_url":"https://avatars.githubusercontent.com/u/1101455?v=3","gravatar_id":"","url":"https://api.github.com/users/akolpakov","html_url":"https://github.com/akolpakov","followers_url":"https://api.github.com/users/akolpakov/followers","following_url":"https://api.github.com/users/akolpakov/following{/other_user}","gists_url":"https://api.github.com/users/akolpakov/gists{/gist_id}","starred_url":"https://api.github.com/users/akolpakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akolpakov/subscriptions","organizations_url":"https://api.github.com/users/akolpakov/orgs","repos_url":"https://api.github.com/users/akolpakov/repos","events_url":"https://api.github.com/users/akolpakov/events{/privacy}","received_events_url":"https://api.github.com/users/akolpakov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-04T21:45:32Z","updated_at":"2015-11-04T21:45:32Z","closed_at":null,"body":"[At this line](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/utils/html.py#L65) function ``parse_html_dict`` allow to parse dictionaries with primitive values like:\r\n```\r\n    {\r\n        'profile.username': 'example',\r\n        'profile.email': 'example@example.com',\r\n    }\r\n        -->\r\n    {\r\n        'profile': {\r\n            'username': 'example',\r\n            'email': 'example@example.com'\r\n        }\r\n    }\r\n```\r\n\r\nBut if value is an array parser does not work properly:\r\n```\r\n    {\r\n        'profile.username': 'example',\r\n        'profile.email': 'example@example.com',\r\n        'profile.group': ['1', '2'],\r\n    }\r\n```\r\n\r\nProblem that QueryDict on the [line](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/utils/html.py#L83):\r\n```python\r\nfor field, value in dictionary.items():\r\n```\r\n\r\n``dictionary.items()`` returns last item from list ['1', '2'] as a ``value``.\r\n\r\nI have the following Serializer:\r\n\r\n```python\r\nclass ProfileSerializer(serializers.ModelSerializer):\r\n    class Meta:\r\n        model = Profile\r\n\r\nclass UserSerializer(serializers.ModelSerializer):\r\n    profile = ProfileSerializer(required=False)\r\n```\r\n\r\nand ``group`` is a ``ManyToMany`` field in ``Profile`` model."}}