Alfred Morgan <> added the comment:

@serhiy.storchaka while you are doing your overhaul will you please add support 
for raw json values. I often find myself where I have a serialized object that 
I want to include in an object response that I'm about to serialize anyway. The 
implementation should be very simple. Here is my workaround code:

class RawJSON(str): pass

origEnc = json.encoder.encode_basestring_ascii
def rawEnc(obj):
  if isinstance(obj, RawJSON):
    return obj
  return origEnc(obj)
json.encoder.encode_basestring_ascii = rawEnc


Python tracker <>
Python-bugs-list mailing list

Reply via email to