0

I use JSONpath but despite my research I don't find some response.

Look at one exemple of my object

  "definitions" : {
    "person" : {
      "properties" : {
        "person_id" : {
          "format" : "int32",
          "type" : "integer"
        },
        "birth_date" : {
          "format" : "date-time",
          "type" : "string"
        },
        "sur_name" : {
          "type" : "string"
        },
        "first_name" : {
          "type" : "string"
        }
      },
      "type" : "object"
    }
  },

And i am currently using this path : $.[*].type

And my result is

[
  "object",
  "integer",
  "string",
  "string",
  "string"
]

But I want to show only my "string" type and I don't know how

I use that docs https://github.com/json-path/JsonPath

Thank you ! :)

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
Ant3xes
  • 51
  • 8

1 Answers1

0

$..[?(@.type == 'string')].type this will show as follow. Is that what you want?

[
  "string",
  "string",
  "string"
]
yu.pitomets
  • 1,660
  • 2
  • 17
  • 44