Hello Friends:
A Data Structure like the following is created and returned to the Frontend via an anvil.server.call() to a Backend Server Module:
Returned:
d = { 'k1' : [NamedTuple(a='a1', b='b1'),
NamedTuple(a='a2', b='b2'),
NamedTuple(a='a3', b='b3')],
'k2' : [NamedTuple(a='c1', b='d1'),
NamedTuple(a='c2', b='d2'),
NamedTuple(a='c3', b='d3')],
'k3' : [NamedTuple(a='e1', b='f1'),
NamedTuple(a='e2', b='f2'),
NamedTuple(a='e3', b='f3')], }
Backend testing behaves properly. For example:
d['k2'][1].b
does indeed return d2
.
However, the Frontend receives a flattened Data Structure like the following (which isn’t subscriptable by attribute as with NamedTuples) :
Received:
d = { 'k1' : ['a1', 'b1'], ['a2', 'b2'], ['a3', 'b3'],
'k2' : ['c1', 'd1'], ['c2', 'd2'], ['c3', 'd3'],
'k3' : ['e1', 'f1'], ['e2', 'f2'], ['e3', 'f3'] }
I suspect it’s serialization / deserialization (Marshalling) related, and am wondering if the community can set me straight with this.
PS: It’s unrelated to the problem, but I’m doing this to save some round-trips.
Thank you!