tryGet

Assign j[key] into val only when the key is present, its JSON type matches T, and (for narrow integral T) the wire value fits in T's range. Leaves val untouched otherwise (preserving any default). Returns whether the assignment happened. Never throws.

  1. bool tryGet(Json j, string key, T val)
    @safe @safe
    bool
    tryGet
    (
    T
    )
    (
    Json j
    ,
    string key
    ,
    ref T val
    )
    if (
    !is(T : Nullable!U,
    U
    )
    )
  2. bool tryGet(Json j, string key, N val)