def get_object_as_json(o, cls, ignore_wrappers=True, complex_as=list, encoding='utf8', polymorphic=False): prot = JsonDocument(ignore_wrappers=ignore_wrappers, complex_as=complex_as, polymorphic=polymorphic) ctx = FakeContext(out_document=[prot._object_to_doc(cls,o)]) prot.create_out_string(ctx, encoding) return ''.join(ctx.out_string)
def get_object_as_json(o, cls=None, ignore_wrappers=True, complex_as=list, encoding="utf8", polymorphic=False): if cls is None: cls = o.__class__ prot = JsonDocument(ignore_wrappers=ignore_wrappers, complex_as=complex_as, polymorphic=polymorphic) ctx = FakeContext(out_document=[prot._object_to_doc(cls, o)]) prot.create_out_string(ctx, encoding) return "".join(ctx.out_string)
def get_object_as_json(o, cls=None, ignore_wrappers=True, complex_as=list, encoding='utf8', polymorphic=False, indent=None, **kwargs): if cls is None: cls = o.__class__ prot = JsonDocument(ignore_wrappers=ignore_wrappers, complex_as=complex_as, polymorphic=polymorphic, indent=indent, **kwargs) ctx = FakeContext(out_document=[prot._object_to_doc(cls, o)]) prot.create_out_string(ctx, encoding) return b''.join(ctx.out_string)
def get_object_as_json(o, cls, ignore_wrappers=True, complex_as=list, encoding="utf8"): prot = JsonDocument(ignore_wrappers=ignore_wrappers, complex_as=complex_as) ctx = FakeContext(out_document=[prot._object_to_doc(cls, o)]) prot.create_out_string(ctx, encoding) return "".join(ctx.out_string)