示例#1
0
        public void ObjectNameLengthExpression_LastItem()
        {
            var json = new JsonObject
            {
                { "name", new JsonArray {
                      1, 2, 3
                  } },
                { "name2", new JsonArray {
                      1, 2, 3
                  } },
                { "test", new JsonArray {
                      1, 2
                  } },
            };
            var path     = JsonPathWith.Array(jv => JsonPathRoot.Name("test").Length());
            var expected = new JsonArray {
                new JsonArray {
                    1, 2
                }
            };

            var actual = path.Evaluate(json);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
 public void WhyOnGodsGreenEarthWouldAnyoneDoThis()
 {
     _Run(JsonPathWith.Array(jv => 4 + jv.Length() * (JsonPathRoot.Name("name").Length() - 2) + 5),
          "$[([email protected]*($.name.length-2)+5)]");
 }