Revision e91ffe49
b/lib/serializer.py | ||
---|---|---|
26 | 26 |
""" |
27 | 27 |
|
28 | 28 |
import simplejson |
29 |
import ConfigParser |
|
30 | 29 |
import re |
31 | 30 |
|
32 | 31 |
# Check whether the simplejson module supports indentation |
... | ... | |
36 | 35 |
except TypeError: |
37 | 36 |
_JSON_INDENT = None |
38 | 37 |
|
39 |
_RE_EOLSP = re.compile('\s+$', re.MULTILINE)
|
|
38 |
_RE_EOLSP = re.compile('[ \t]+$', re.MULTILINE)
|
|
40 | 39 |
|
41 | 40 |
|
42 | 41 |
def DumpJson(data): |
... | ... | |
47 | 46 |
txt = simplejson.dumps(data) |
48 | 47 |
else: |
49 | 48 |
txt = simplejson.dumps(data, indent=_JSON_INDENT) |
49 |
txt = _RE_EOLSP.sub("", txt) |
|
50 | 50 |
if not txt.endswith('\n'): |
51 | 51 |
txt += '\n' |
52 |
txt = _RE_EOLSP.sub("", txt) |
|
53 | 52 |
return txt |
54 | 53 |
|
55 | 54 |
|
Also available in: Unified diff