Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
JSON path issue to check the specific string in only specified object

I am trying to write a logic to see if value exists in json variable.

logic I wrote is considering state object as well but logic should only be checking in request object in input

We should not return true if we have businessCode in state object. Any help would be greatly appreciated. Here is the logic I have written and need some help in solving this.

var result = x.jsonPath("$..configurations[?(@.businessCode == 'Needed Object')].businessCode");
        if (result != null && result.elementList().length > 0) {
            IsNeeded = true;
        }

Here is my input

{
  "state": {
    "PriceResult": {
      "products": [
        {
          "configurations": [
            {
              "businessCode": "Needed object",
              "configurations": []
            }
          ]
        }
      ]
    }
  },
  "request": {
    "body": [
      {
        "products": [
          {
            "configurations": [
              {
                "listPrice": 29.99,
                "businessCode": "Needed object"
              }
            ],
            "id": "271811"
          }
        ],
        "id": "1022501"
      },
      {
        "products": [
          {
            "configurations": [
              {
                "listPrice": 29.99,
                "businessCode": "NOT Needed"
              }
            ],
            "id": "22222"
          }
        ],
        "id": "1111111"
      }
    ]
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!