JMESPath.Net
A fully compliant implementation of JMESPath for .Net Core.
Getting started
Using the parser
JMESPath.Net
uses Newtonsoft.Json to handle JSON
and comes with a simple to use parser:
using DevLab.JmesPath;
const string input = @"{ \"foo\": \"bar\" }";
const string expression = "foo";
var jmes = new JmesPath();
var result = jmes.Transform(input, expression);
The JmesPath.Transform
method accepts and produces well formed JSON constructs (object, array or string, boolean, number and null values).
In the example above, the result
is a JSON string token, including the quotes.
using Newtonsoft.Json.Linq;
System.Diagnostics.Debug.Assert(result == "\"bar\"");
var token = JToken.Parse(result);
var text = token.ToString();
System.Diagnostics.Debug.Assert(text == "bar");