I am using jsonpickle to turn a nested python object into json. Python class:
class Cvideo:
def __init__(self):
self._url = None
@property
def url(self):
return self._url
@url.setter
def url(self, value):
self._url = value
Module for serialization:
def create_jason_request(self, vid1: Cvideo):
vid1 = Cvideo()
vid1.url = entry['uploader_url'] # will get a leading underscore
vid1.notdefinedproperty = "test" # wont get a leading underscore in json
return jsonpickle.encode(vid, unpicklable=False)
Unfortunately the created json depicts _url instead of url. How to avoid leading underscore creation in json when using pythin properties? thanks.