This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Zectbumo
Recipients Aaron.Staley, Zectbumo, eric.araujo, ezio.melotti, ned.deily, pitrou, rhettinger, serhiy.storchaka, vlcinsky
Date 2018-04-14.15:53:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523721229.86.0.682650639539.issue14573@psf.upfronthosting.co.za>
In-reply-to
Content
@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

https://stackoverflow.com/a/48985560/289240
History
Date User Action Args
2018-04-14 15:53:49Zectbumosetrecipients: + Zectbumo, rhettinger, pitrou, ned.deily, ezio.melotti, eric.araujo, Aaron.Staley, serhiy.storchaka, vlcinsky
2018-04-14 15:53:49Zectbumosetmessageid: <1523721229.86.0.682650639539.issue14573@psf.upfronthosting.co.za>
2018-04-14 15:53:49Zectbumolinkissue14573 messages
2018-04-14 15:53:49Zectbumocreate