Vibe.d json to csv
Sönke Ludwig via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 7 14:37:01 PDT 2015
Am 05.04.2015 um 06:24 schrieb Sebastiaan Koppe:
> (...)
> I can probably use zip to get the quotes around the names, to avoid
> concatenation. But it works fine the way it is. The problem is, the
> following doesn't:
>
> ```
> void csvRow(const Json jsonObject)
> {
> return values(jsonObject.get!(Json[string])).stdMap!(a
> =>`"`~a~`"`).joiner(",");
> }
> ```
From the looks of it, the problem is that the concatenation there
yields a Json value instead of a string (because concatenation also
works for adding elements to a JSON array for example). If all elements
are known to be strings, using `"`~a.get!string~`"` should make it work.
More information about the Digitalmars-d-learn
mailing list