Getting property names using JSONPath and Json.Net

311 views Asked by At

Is there a way to use JSONPath with Json.Net to get the property names in a nested json.

To be clear, here is a sample json:

{
  "fields": {
    "hum": 48.1,
    "temp": 24.4
  }
}

What I need in this case is temp and hum.

I saw some implementations where they support the usage of a tilde (~) in the jsonPath to fetch that information. For reference: https://github.com/JSONPath-Plus/JSONPath

So in this case it would mean something like $.fields.*~

I tried using the online demo of that lib and it works like a charm but I need that feature in dotnet core and I can't find it.

0

There are 0 answers