List<num> toJson() { // Match javascript style of making numbers ints if they are 1.0, 2.00 etc. return elements.map((e) => (e % 1) == 0 ? e.round() : e).toList(); }