Skip to main content

A Object-JSON Document mapper

Project description

PODM: (P)ython (O)bject-json (D)ocument (M)apper

This library is intended to create objects that easily map to a well defined json format, for cases where jsonpickle format is not good. Only available for Python3

Some use case samples

class Entity(JsonObject):
	"""
	A base class for the object model
	"""
	oid = Property()
	created = Property('created', default=datetime.now) # Default value when object is instantiated

class Company(Entity):
	company_name = Property('company-name') # Specify a different field name in json.
	description = Property()        

class Sector(Entity):
	employees = Property('employees')

	def __init__(self,**kwargs):
		super(Sector, self).__init__(**kwargs)
		# Default value for _employees
		self._employees = []

class Employee(Entity):
	name = Property()

company = Company(
  name='My great company',
  description='....'
)

json_data = company.to_dict()

company_2 = Company.from_dict(json_data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

podm-0.0.2.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

podm-0.0.2-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page