Replies: 2 comments 1 reply
-
Hi, So for a variable-length array you can define JS::Nullable<JS::ArrayVariableContent<....>> foo; If you want it to also be optional then it can be something like: |
Beta Was this translation helpful? Give feedback.
-
Optionally you can make your own type with a typehandler. This is pretty trivial. This is the whole implementation for ArrayVariableContent:
Then you can add a null check in the Also when you write your own type its trivial to make it optional by adding Maybe we should have something like this for null as well, although I think the concept is different. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Tried variable-length arrays - works perfectly, but...
I have an input, that can contain null-able arrays, such as:
...,"CmdParams":null,...
...,"CmdParams":["param_1","param_2"],...
It would be nice that json_struct can handle these (just as zero size JS::ArrayVariableContent<>) - json_struct is just perfect for my needs (except that issue).
Beta Was this translation helpful? Give feedback.
All reactions