Skip to content

Instantly share code, notes, and snippets.

@emil-palm
Created October 17, 2013 07:48
Show Gist options
  • Save emil-palm/7020780 to your computer and use it in GitHub Desktop.
Save emil-palm/7020780 to your computer and use it in GitHub Desktop.
from ujson import dumps
import pprint
class Test:
def __init__(self):
self.data = "foobar"
self._data = "barfoo"
class Test2(Test):
def toDict(self):
return {"foobar":"majs"}
t1 = Test()
t2 = Test2()
pprint.pprint(dumps(t1))
pprint.pprint(dumps(t2))
################
# python test.py
# '{"data":"foobar"}'
# '{"foobar":"majs"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment