Is there a way to get the JsonPointer of a given Linq.Expression as it would be serialized by a given Newtonsoft.Json contract resolver?
e.g.
public class Foo { public string Bar { get; set; } }
var path = GetJsonPointer<Foo>(x => x.Bar, new CamelCasePropertyNamesContractResolver())
//how to write GetJsonPointer so that "path" would equal "/bar"?
The trickiest part here is to get the name of a property as it's going to be serialized. You can do that in the following way:
Once you have that, you can just handle each level of the expression and pop the result onto a string stack. The following quick-and-dirty implementation supports indexing in addition to simple member access.
Example of invocation: