Closed dezashibi closed 1 year ago
Dic::join()
only works on one level (key: value, ...). The Dic
class knows nothing about nesting. join() converts all keys and values to String
, if possible. A value of type Var
is just converted to String with its toString()
method that does a simple serialization, always using ',', '=' for objects.
Json::encode()
and Xdl::encode()
are better ways to serialize nested objects, but they have a fixed syntax. Making .join()
smarter for the Dic<Var>
case would be too complicated. You could look at the Var::toString()
function to make new configurable function out of the library.
I checked, yes might make it complicated, I will though try to see if I can do something about it and if the solution was good enough to be put in the ASL I will open pull request. thanks.
consider an
Object
isDic<Var>
that naturally can have otherObject
s orArray<Object>
as well inside when I usejoin
on the top level and let's say I want ", " and " : " it won't make any difference to the nested objects and it will use the default "," and "=" instead.P.S. to print out the
Object
I can useJson::encode
which is fine, in some cases join characters might be completely different based on usecases.