-def _GetJsonDumpers(_encoder_class=simplejson.JSONEncoder):
- """Returns two JSON functions to serialize data.
-
- @rtype: (callable, callable)
- @return: The function to generate a compact form of JSON and another one to
- generate a more readable, indented form of JSON (if supported)
-
- """
- plain_encoder = _encoder_class(sort_keys=True)
-
- # Check whether the simplejson module supports indentation
- try:
- indent_encoder = _encoder_class(indent=_JSON_INDENT, sort_keys=True)
- except TypeError:
- # Indentation not supported
- indent_encoder = plain_encoder
-
- return (plain_encoder.encode, indent_encoder.encode)
-
-
-(_DumpJson, _DumpJsonIndent) = _GetJsonDumpers()
-
-
-def DumpJson(data, indent=True):