public void ReadStringOptional()
    {
        JsonDocument jdoc = JsonDocument.Parse("{\"foo\":\"abc\"}");

        // Test success case.
        string val = string.Empty;

        JsonReadOptionalUtils.ReadStringOptional(jdoc.RootElement, "foo", x => val = x);
        Assert.Equal("abc", val);

        // Test missing optional.
        val = string.Empty;
        JsonReadOptionalUtils.ReadStringOptional(jdoc.RootElement, "bar", x => val = x);
        Assert.Equal(string.Empty, val);
    }
        public void ReadStringOptional()
        {
            JObject jobj = JObject.Parse("{'foo':'abc'}");

            // Test success case.
            string val = string.Empty;

            JsonReadOptionalUtils.ReadStringOptional(jobj, "foo", x => val = x);
            Assert.AreEqual("abc", val);

            // Test missing optional.
            val = string.Empty;
            JsonReadOptionalUtils.ReadStringOptional(jobj, "bar", x => val = x);
            Assert.AreEqual(string.Empty, val);
        }