diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2010-02-22 20:01:10 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2010-02-22 20:01:10 (GMT) |
commit | b256fc61ac3d7841a39e5f2d5c6ec442246cc10b (patch) | |
tree | 31c290b322a82699d5727f7e01ff6edfe584a039 /tautils.py | |
parent | f7e5c95b67408e71bb76a8a9025689d8e442e38c (diff) |
strip newlines from json strings
Diffstat (limited to 'tautils.py')
-rw-r--r-- | tautils.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -46,7 +46,11 @@ def json_load(text): if _old_Sugar_system is True: listdata = json.read(text) else: - io = StringIO(text) + # strip out leading and trailing whitespace, nulls, and newlines + text = text.lstrip() + text = text.replace('\12','') + text = text.replace('\00','') + io = StringIO(text.rstrip()) listdata = jload(io) # json converts tuples to lists, so we need to convert back, return _tuplify(listdata) |