jsonstruct icon indicating copy to clipboard operation
jsonstruct copied to clipboard

Getting error while decoding : AttributeError: type object 'BaseHandler' has no attribute '_registry'

Open Harshit378 opened this issue 6 years ago • 0 comments

I am using jsonstruct to convert Sonar API response json to python classes but it is throwing type object 'BaseHandler' has no attribute '_registry'

Attached json file : sample json.txt

Using https://app.quicktype.io/ I am converting above json to @dataclasses

sample json.txt dataclass.txt

Dataclass name : dataclass.txt

Now the below code is giving the error:

e = jsonstruct.decode(json_string, SonarIssues.Welcome) print(e)

Exception stack trace -

e = jsonstruct.decode(json_string, SonarIssues.Welcome)

File "C:\python\lib\site-packages\jsonstruct_init_.py", line 127, in decode return j.restore(json.decode(string), cls) File "C:\python\lib\site-packages\jsonstruct\unpickler.py", line 95, in restore HandlerClass = handlers.BaseHandler._registry.get(cls_def) AttributeError: type object 'BaseHandler' has no attribute '_registry'

Harshit378 avatar Oct 16 '19 13:10 Harshit378