Issue 9668: strings in json.dump in '' instead of "" (original) (raw)
could not reproduce:
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
from cStringIO import StringIO as F import json json.dumps('foo') '"foo"' f=F() json.dump('foo',f) f.seek(0,0);f.read();f.seek(0,0) '"foo"' json.dump({'a':['b']},f) f.seek(0,0);f.read();f.seek(0,0) '{"a": ["b"]}'
Python 2.6.5+ (release26-maint, Jul 30 2010, 23:04:10) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import json from cStringIO import StringIO as F f=F() json.dump('foo',f) json.dumps('foo') '"foo"' f.seek(0,0);f.read();f.seek(0,0) '"foo"' json.dump({'a':1,'':2},f) f.seek(0,0);f.read();f.seek(0,0) '{"a": 1, "": 2}' json.dumps({'a':1,'':2}) '{"a": 1, "": 2}'