Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Differentiate between object and array of objects #19

Copy link
Copy link
@pradp

Description

@pradp
Issue body actions
var sample1 = {
  "book" : {
    "name" : "book 1",
    "type" : "type 1"
  }
}

var sample2 = {
  "book" : [{
      "name" : "book 1",
      "type" : "type 1"
    }, {
      "name" : "book 2",
      "type" : "type 2"
    }, {
      "name" : "book 3",
      "type" : "type 3"
    }
  ]
}

Can any one help me to construct a single JSON path to extract the book name for which the type = "type 1" from both the samples? The problem is the book can be an array or an object but I can have only one json path to extract the value. Any help would be appreciated.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.