Re: Json output to container

2020-10-30 Thread Paul Backus via Digitalmars-d-learn
On Friday, 30 October 2020 at 19:07:20 UTC, Vino wrote: Requirement: parse the json string and store the output to a container. From, Vino.B Here's a working version of the code from your original post: import asdf : parseJson; import std.algorithm; import std.container.array; import

Re: Json output to container

2020-10-30 Thread Vino via Digitalmars-d-learn
On Friday, 30 October 2020 at 19:07:20 UTC, Vino wrote: On Friday, 30 October 2020 at 18:41:35 UTC, Paul Backus wrote: On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote: Hi, Request your help on the below code [...] .filter!(a => a.(["items"].byElement)) What exactly

Re: Json output to container

2020-10-30 Thread Vino via Digitalmars-d-learn
On Friday, 30 October 2020 at 18:41:35 UTC, Paul Backus wrote: On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote: Hi, Request your help on the below code [...] .filter!(a => a.(["items"].byElement)) What exactly are you trying to accomplish with this `a.(stuff)`

Re: Json output to container

2020-10-30 Thread Paul Backus via Digitalmars-d-learn
On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote: Hi, Request your help on the below code [...] .filter!(a => a.(["items"].byElement)) What exactly are you trying to accomplish with this `a.(stuff)` syntax? As I'm sure you've discovered, it is not valid D, but it

Re: Json output to container

2020-10-30 Thread Vino via Digitalmars-d-learn
On Friday, 30 October 2020 at 17:56:22 UTC, Andre Pany wrote: On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote: Hi, Request your help on the below code Code: import asdf: parseJson; import std.algorithm; import std.container.array; import std.stdio: writeln; import std.typecons:

Why is vibe.d json serializer/deserializer so complex?

2020-10-30 Thread Steven Schveighoffer via Digitalmars-d-learn
I was looking to report an enhancement request to vibe.data.json (filed here: https://github.com/vibe-d/vibe.d/issues/2490), and I started looking at the serialization code for vibe. It's really really complicated, and I'm just wondering if this is a case of overengineering, or if there's a

Re: Json output to container

2020-10-30 Thread Andre Pany via Digitalmars-d-learn
On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote: Hi, Request your help on the below code Code: import asdf: parseJson; import std.algorithm; import std.container.array; import std.stdio: writeln; import std.typecons: Tuple, tuple; void main() { string apidata1 = `{"items": [

Re: How would I go about unittesting a vibe.d app?

2020-10-30 Thread rinfz via Digitalmars-d-learn
On Friday, 30 October 2020 at 13:26:59 UTC, rinfz wrote: ... Seems I have got something working using the fluent-asserts-vibe package.

How would I go about unittesting a vibe.d app?

2020-10-30 Thread rinfz via Digitalmars-d-learn
For example, I am trying to test a route. Within the unittest I setup the server locally (note: is it possible to start the server once for all unit tests?), then call listenHTTP. After the listen call I make a client request to localhost with requestHTTP and I get the following error:

Re: What is the difference between enum and shared immutable?

2020-10-30 Thread Max Samukha via Digitalmars-d-learn
On Thursday, 29 October 2020 at 16:45:51 UTC, Ali Çehreli wrote: immutable string p; shared static this() { p = environment["PATH"]; // <-- Run time } Immutable static variables being implicitly non-thread-local is a design mistake. Thread-local immutable variables have the same right

Json output to container

2020-10-30 Thread Vino via Digitalmars-d-learn
Hi, Request your help on the below code Code: import asdf: parseJson; import std.algorithm; import std.container.array; import std.stdio: writeln; import std.typecons: Tuple, tuple; void main() { string apidata1 = `{"items": [ {"name":"T01","hostname":"test01","pool":"Development"},

Re: What is the difference between enum and shared immutable?

2020-10-30 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Oct 29, 2020 at 4:13 PM H. S. Teoh via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > > But why can't that be treated differently from explicitly writing @safe > on a declaration? I mean, yeah, it's easier to implement the compiler > that way, but ease of