d = {}
for k, v in ordered_pairs:
    if k in d:
        raise ValueError('duplicate key: %r' % (k,))
else:
    d[k] = v
return d
json.loads(raw_post_data, object_pairs_hook=dict_raise_on_duplicates)
json.loads allows duplicate keys in a dictionary, overwriting the first value