How to detect whethere if a JSON node exists

Adam D. Ruppe destructionator at gmail.com
Mon Apr 13 02:22:33 UTC 2020


On Monday, 13 April 2020 at 02:20:39 UTC, Adnan wrote:
> Now in the above inner loop getStr(node["com"].str()) crashes 
> in runtime if an array does not contain "com" node. I want to 
> avoid that. How should I proceed?

Try:

if("com" in node) {

}


More information about the Digitalmars-d-learn mailing list