Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda