Skip to content
/ Coeus Public

JQ-style queries for JSON.NET in any .NET Core process.

License

Notifications You must be signed in to change notification settings

jplane/Coeus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coeus - JQ-compatible JSON Queries in .NET

Coeus NUGET Package NuGet

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.

Goals

  • 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

Usage

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

Background and Resources

  • The JQ manual is a wealth of information about query syntax and behavior

  • Coeus is implemented using the excellent Sprache parser combinator library

  • More on parser combinators here. Your head will hurt, until it doesn't :-)

About

JQ-style queries for JSON.NET in any .NET Core process.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published