Coeus NUGET Package | |
Simply put, Coeus implements JQ-compatible queries for JSON.NET. Query and update JToken, JObject, JArray, JValue and friends.
JQ is more powerful than JSON Path/Patch and is a widely-adopted pseudo-standard from the Linux command line.
-
Simple extension methods for System.String to query against JToken
-
No CLI (yet)
-
100% JQ compatibility may not be realistic, though we'll strive to include most operators and functions
var json = new JObject
{
["foo"] = new JArray { 1, 2, 3 }
};
var query = "{ \"bar\": .foo[2] }";
var output = query.EvalToToken(json);
// output --> { 'bar': 3 }
Console.WriteLine(output["bar"].Value<int>()); // 3