Subclassing json() & error on recursive load #1201
Labels
state: help needed
the issue needs help to proceed
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
Hey
So I have subclassed json with another class so that in future if I want to change the container class/type I can just replace that within my class and not have to go over entire app replacing all containers.
Essentially class looks like this :
Now the issue is when I have a json file I read from file, that has some name/id/etc information + children which is of the same structure.
The initial object load file, but the children throw me an error.
Say if I do
data["name] < this prints name.
if I do data["children"].count() < this gets me proper count
if I do data["children"][0]["name] < this gets me name of child - all great.
But if I try to pass that object to newly created class to configure it. Say child class I get this error :
Essentially loops goes as follow:
Errors starts here:
Its driving me nuts, as far as I debug it, everything is of proper myObject class & have data whenever I print it. But the second I try to generate child from json["children"]array I get an crash :- (
Does this look familiar to any one?
TIA
Btw I have no idea why formating is off ;[
Edit1. Thanks Nlohmann for formating fix! : -)
I also did test with using json, instead of myObject class and everyhing works. So there is a weird issue when I try to load children as my subclass class thini ?
The text was updated successfully, but these errors were encountered: