How to convert map type to object #1422
Unanswered
rostik404
asked this question in
Q&A - General
Replies: 1 comment
-
Hi @rostik404 It's more of a protobuf question, but thanks for asking here. :) You can maybe take a look at the map implementation / APIs to see if there's anything you can do better: From what I can roughly tell form a quick look, it seems that Map could e implemented as array internally, and hence maybe that's why "toObject" returned as such. Not sure if there's other quick JS tricks you could do to quickly do such conversions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I have a next proto type:
Next, I'm making an object of this type:
And then, I'm trying to lead this type to an object:
So, I'm getting this structure:
But I'm expecting a structure like this:
According to this file, the behaviour with "valuesMap" is valid. However, is there any way to convert a proto to an object as I'm expecting?
Also, the provided example is synthetic. In real case I have a recursive structure like this:
So instead of using just
res.toObject()
, I need to write some recursive function on a client to transform this object.Beta Was this translation helpful? Give feedback.
All reactions