public void Issue31_JsonPathArrayOperatorShouldWorkOnObjects_Constructed() { var json = GoessnerExamplesTest.GoessnerData; var path = JsonPathWith.Name("store") .Name("bicycle") .Array(jv => 1 == 1); var results = path.Evaluate(json); Assert.AreEqual(new JsonArray { "red", 19.95 }, results); }
public void GoessnerExample3Constructed() { var path = JsonPathWith.Name("store").Name(); var expected = new JsonArray { new JsonArray { new JsonObject { { "category", "reference" }, { "author", "Nigel Rees" }, { "title", "Sayings of the Century" }, { "price", 8.95 } }, new JsonObject { { "category", "fiction" }, { "author", "Evelyn Waugh" }, { "title", "Sword of Honour" }, { "price", 12.99 } }, new JsonObject { { "category", "fiction" }, { "author", "Herman Melville" }, { "title", "Moby Dick" }, { "isbn", "0-553-21311-3" }, { "price", 8.99 } }, new JsonObject { { "category", "fiction" }, { "author", "J. R. R. Tolkien" }, { "title", "The Lord of the Rings" }, { "isbn", "0-395-19395-8" }, { "price", 22.99 } } }, new JsonObject { { "color", "red" }, { "price", 19.95 } } }; var actual = path.Evaluate(GoessnerData); Assert.AreEqual(expected, actual); }
public void SingleWildcardObject() { Run(JsonPathWith.Name(), "$.*"); }
public void EmptyKey() { Run(JsonPathWith.Name(""), "$.''"); }
public void DoubleQuotedNamedObject() { Run(JsonPathWith.Name("quoted name"), "$.\"quoted name\""); }
public void WeirdPropertyNameQuoted() { Run(JsonPathWith.Name("tes* \"t"), "$.\"tes* \\\"t\""); }
public void ChainedNameName() { Run(JsonPathWith.Name("name").Name("test"), "$.name.test"); }
public void ChainedNameIndexedArray() { Run(JsonPathWith.Name("name").Array(4), "$.name[4]"); }
public void SingleQuotedNamedObject() { Run(JsonPathWith.Name("quoted name"), "$.'quoted name'"); }
public void SingleNamedObject() { Run(JsonPathWith.Name("name"), "$.name"); }
public void EmptyKey() { Run("$.''", JsonPathWith.Name("")); }
public void ObjectChain() { Run("$.name.test", JsonPathWith.Name("name").Name("test")); }
public void ObjectKey() { Run("$.name", JsonPathWith.Name("name")); }