MaciejPL
MaciejPL

Reputation: 1049

JsonPath get all child elements except first one

Can you lease help me with getting this jsonpath work. I can do it in two ways. Get all object except name of first one or get all of them except first one. (like an list filtering).

Json look like this

{

  "temp" : {
    "translate_mode" : "custom",

  },
  "body" : {
    "string" : "custom2",

  },
  "content" : {
    "mode" : "custom2",

  }
}

Upvotes: 0

Views: 2261

Answers (1)

Daniel
Daniel

Reputation: 753

Note that your sample JSON is malformed, as the last object member cannot end with a comma. And there is no notion of the "first" member of a JSON object. But I assume that you simply want to filter out the member named 'temp'.

Your ability to do so depends upon the capabilities of your favourite JSONPath evaluator filter, which is largely implementation specific.

Comparing evaluators on https://jsonpath.herokuapp.com/, jayway will accept

$.*[?([email protected]_mode)]

and return the objects that do not have the name 'translate_mode',

[
   {
      "string" : "custom2"
   },
   {
      "mode" : "custom2"
   }
]

but that doesn't work with Goessner.

Upvotes: 1

Related Questions