On Mon, 15 May 2017 09:10:39 GMT, Timoses wrote:


would it make sense to make the return value of
appendArrayElement the modified Json?
This would enable something like:

auto json = Json.emptyObject;
json["arrayEntry"] = Json.emptyArray().appendArrayElement(Json(5));

Or is there a neater way of achieving the same thing?

For this specific situation I'd probably just use an array literal directly (= Json([Json(5)])), but I don't see a real argument against letting appendArrayElement return the result anyway. Using it for method chaining might sometimes also be handy.