Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda