Skip to main content

Python Serializer tool

Project description

from pyseri import serializer

class A():
	name = 'class a'

class B():
	name = 'class b'
	a = [A(), A(), A()]

serializer.dump(B(), mapper={'A': {'name'}, 'B':{'name', 'a'}})

#output
"""
{
	'name': 'class b',
	'a': [
		{'name': 'class a'}, 
		{'name': 'class a'},
		 {'name': 'class a'}
	 ]
}
"""
from pyseri import serializer

class A():
	getters = ['name']
	#this key is important
	name = 'class a'

class B():
	getters = ['name', 'a']
	#this key is important
	name = 'class b'
	a = [A(), A(), A()]

serializer.dump(B())

#output
"""
{
	'a': [
		{'name': 'class a'}, 
		{'name': 'class a'}, 
		{'name': 'class a'}
	],
	'name': 'class b'}
"""

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

pyseri-1.1.1.tar.gz (1.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page