Json output to container
Vino
akashvino79 at gmail.com
Fri Oct 30 19:17:15 UTC 2020
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 are you trying to accomplish with this
>> `a.(stuff)` syntax? As I'm sure you've discovered, it is not
>> valid D, but it appears in several places in your code.
>
> Hi,
>
> I was just trying the example code in the link
> https://code.dlang.org/packages/asdf, it is just an example,
> hence request your help to correct me.
>
> Requirement: parse the json string and store the output to a
> container.
>
> From,
> Vino.B
Requirnment :
string apidata1 = `{"items":
[
{"name":"T01","hostname":"test01"},
{"name":"T02","hostname":"test02"},
{"name":"T03","hostname":"test03"}
]
}`;
string apidata2 = `{"items":
[
{"hostname":"test01","type":"Development"},
{"hostname":"test02","type":"Quality"},
{"hostname":"test03","type":"Production"}
]
}`;
string apidata2 = `{"items":
[
{"type":"Development","Location":"L1"},
{"type":"Quality","Location":"L2"},
{type":"Production","Location":"L3"}
]
}`;
1. Parse the apidata1(name,hostname)
2. For each "hostname" get the "type" data from api2(type)
3. For each "type" get the "Location: from api3(Location)
4. And store the result in a container with data
(Name,Hostname,Type,Location)
From,
Vino.B
More information about the Digitalmars-d-learn
mailing list