From b256fc61ac3d7841a39e5f2d5c6ec442246cc10b Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Mon, 22 Feb 2010 20:01:10 +0000 Subject: strip newlines from json strings --- (limited to 'tautils.py') diff --git a/tautils.py b/tautils.py index d7cd903..8352980 100644 --- a/tautils.py +++ b/tautils.py @@ -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) -- cgit v0.9.1