I frequently use JsonNode as a container for Any object.
Another use case is how it's used for JSON, YAML, XML, etc. formats. Right now every such library had to create its own object mapper. While it would be much easier if std/any provided the Any <-> Nim conversions, and the custom library only need to provide Any <-> JSON/YAML/XML.
It will also make possible to easily switch between formats. You set some custom serialisations for your objects to JSON. And now you want to also save it to YAML, but you can't because YAML is totally different library and you need to specify custom serialisation rules again. But with Any it would work well, as it's going to work like this Nim <- custom rules -> Any and then totally independent Any <-> JSON/YAML/...
What do you think?
Any <-> JSON/XML/YAML can be implemented using compile-time introspection and serialization, see treeform/jsony for example. nimyaml also allows to unmarshall objects to and from. https://nimyaml.org/serialization.html
At the same time, solving this problem in general is hardly possible, because each serialization format has its own special quirks and features. For example, how do you map json fields to XML attributes or nested elements? You need to have a schema for this, so you can choose what is an attribute and what is not.
Using types in this case is just overkill and waste of effort, as most of the time it's one time experiment.
That doesn't match my experience at all fwiw, I find types just as useful for "quick'n'dirty" code. Dynamic typing kills productivity, try more static typing.