xxxxxxxxxx
import std.stdio;
import std.json;
import std.algorithm;
import std.array;
struct Person
{
string name;
int age;
JSONValue toJson()
{
return JSONValue(["name": JSONValue(name), "age": JSONValue(age)]);
}
}
void main()
{
Person[] people;
Person p1 = {"Bob", 12};
Person p2 = {"Bob", 12};
people ~= p1;
people ~= p2;
auto json = JSONValue(people.map!(p => p.toJson).array);
writeln(json);
}