In this case, I prefer what yajl does [failing to deserialize the data instead of what json does: convert the integer keys to strings]. It might be nicer to either (a) support integer keys or (b) fail on dumps(), instead of loads().
yajl.dumps({1:2})
'{1:2}'
yajl.loads(yajl.dumps({1:2}))
Traceback (most recent call last):
File "", line 1, in
ValueError: parse error
In this case, I prefer what yajl does [failing to deserialize the data instead of what json does: convert the integer keys to strings]. It might be nicer to either (a) support integer keys or (b) fail on dumps(), instead of loads().
yajl.dumps({1:2}) '{1:2}'
yajl.loads(yajl.dumps({1:2}))
Traceback (most recent call last): File "", line 1, in
ValueError: parse error
json.loads(json.dumps({1:2})) {u'1': 2}