Open arzuhuseyn opened 2 years ago
Not a bug. jdict does not perform deep conversion of dict, since this is normally done by changing json default decoder. If you want to manually craft nested jdict, you just:
a = jdict(
status=True,
data=jdict(
file=jdict(
url=jdict(
short="...",
full="..."
),
metadata=jdict(
size=jdict(bytes=19, readable="19 B"),
name="test_txt",
id="t..."
)
deep conversion (aka factory method) could be implemented as a separate function or jdict static method, but Im not sure how practically important is it. We made jdict to be as lean as possible and support json de-serialization with minimal overhead. But nothing is excluded upfront. Could you provide a rea use case scenario when such feature would be useful?
Not a bug. jdict does not perform deep conversion of dict, since this is normally done by changing json default decoder. If you want to manually craft nested jdict, you just:
a = jdict( status=True, data=jdict( file=jdict( url=jdict( short="...", full="..." ), metadata=jdict( size=jdict(bytes=19, readable="19 B"), name="test_txt", id="t..." ) ... deep conversion (aka factory method) could be implemented as a separate function or jdict static method, but Im not sure how practically important is it. We made jdict to be as lean as possible and support json de-serialization with minimal overhead. But nothing is excluded upfront. Could you provide a rea use case scenario when such feature would be useful?
Hey @asterkin ,
Thanks for the quick response.
I guess I misunderstood the point of this library. On the readme file, you mentioned this library is able to generate a JavaScript-like Python dictionary. Which, you can simply call the js dictionaries like I was mentioned before.
const myObj = {
a: 1,
b: 2,
c: {
d: 3,
f: 4,
},
}
console.log(myObj.c.f) // Should return 4
Can not access children elements Whenever I try to access inner elements (access to the first element is fine) I got an error.
To Reproduce
Expected result / Error