Hi All,

Request your help on how to get the first value of "type" from the below json, the expected output required is as below,

{"characteristicValue":"TT,t...@dev.com,DEV"}

output1: TT
output2: t...@dev.com

Code:

/+dub.sdl:
dependency "asdf" version="~>0.6.6"
+/
import std;
import asdf;

void main()
{
 string data = `{"items":[{
                          "hostname":"test01",
                          "type":[
                                  {"characteristicValue":"TT,t...@dev.com,DEV"},
                                  {"characteristicValue":"000"}
                ]}]}`;

 foreach (ref j; parseJson(data)["items"].byElement()) {
    writeln(j["type"]) ;
 }
}

From
Vino.B

Reply via email to