On Mon, 30 May 2016 18:53:27 GMT, Øivind Loe wrote:
I have a data structure with one field that changes depending on context, i.e.
struct Foo {
string var0;
int var1;
Variant var2;
};How can I make the JSON serialization in Vibe.d treat var2 properly, and generate 10 if it is an int 10, but "xxyz" if it has a string value?
I solved this by using Json as a type for var2 instead of Variant. Not totally happy about it, but it works.