How to detect whethere if a JSON node exists

Adnan relay.public.adnan at outlook.com
Mon Apr 13 02:25:54 UTC 2020


On Monday, 13 April 2020 at 02:22:33 UTC, Adam D. Ruppe wrote:
> 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) {
>
> }

Came back here to say that I found exactly this solution. Thanks.


More information about the Digitalmars-d-learn mailing list