How to convert associative array to key:value?
问题 I need to convert associative array, to put them to Json, but I can't understanf how to do it. Method to!string add unnecessary slashes. int[string] name; name["Python"] = 5; Json tags = Json.emptyObject; //Json object tags["tags"] = name.to!string; writeln(tags); {"tags":"[\"Python\":1]"} I need to get: {"tags":{"Python":1}} Also I am thinking about using tuples so if there is any solution for them I would like to look at it. 回答1: to!string is the wrong approach. You don't want to convert to