How To Read Contains Value From Array

{

        "LEADS_ID": "Z187217267sdws",

        "FULL_NAME": "AIDA VONAWAP AZERAJAMT",

        "ID_USER_ADDED": "asas12121",

        "DT_ADDED": null,

        "FLAG_NB": "0",

        "PRODUCT_NAME": null,

        "FLAG_PRIORITY": "N",

        "SOURCE_NAME": "WIN - Data Robot",

        "TYPE_LEADS": "SI",

        "NAME_SALESMAN": " ",

        "NAME_DEALER": " ",

        "FLAG_LEADS": " "

    },

    {

        "LEADS_ID": "SOSOA12121",

        "FULL_NAME": "ILEIT NAILUYAS",

        "ID_USER_ADDED": "ASJS12121",

        "DT_ADDED": null,

        "FLAG_NB": "0",

        "PRODUCT_NAME": null,

        "FLAG_PRIORITY": "N",

        "SOURCE_NAME": "WIN - Data Robot",

        "TYPE_LEADS": "SI",

        "NAME_SALESMAN": " ",

        "NAME_DEALER": " ",

        "FLAG_LEADS": " "

    },

    {

        "LEADS_ID": "ASASASASASSA",

        "FULL_NAME": "CINDY",

        "ID_USER_ADDED": "LOLOLOL",

        "DT_ADDED": "2019-11-22 00:00:00.0",

        "FLAG_NB": "0",

        "PRODUCT_NAME": "USED - CAR PARTNER",

        "FLAG_PRIORITY": "Y",

        "SOURCE_NAME": "ACC BRO",

        "TYPE_LEADS": "SI",

        "NAME_SALESMAN": " ",

        "NAME_DEALER": " ",

        "FLAG_LEADS": " "

    }

Hello Can Anyone Help Me How to Detect contain value string from this array ?
i’m using
(WS.verifyElementPropertyValue(response, ‘OUT_DATA.LEADS_ID’, varLEADS_ID, FailureHandling.OPTIONAL)) this will give error Expected element property value ‘LYU1212121’ is not equal with actual property value '[LYU1212121, LYU1238474, LYU1248441]

but if i use (WS.verifyElementPropertyValue(response, ‘OUT_DATA[1].LEADS_ID’, varLEADS_ID, FailureHandling.OPTIONAL))

only read 1 array of data

Lists and Arrays start at zero for the first element, one would be the second element, etc. So when you have OUT_DATA[1].LEADS_ID, you are getting the second element of the list or array. If you use OUT_DATA, then you are using a pointer to the whole List or Array collection.

I can’t see what you want to do. You may possiblly would want either of the followings:

  1. You want to see if the varLEADS_ID (with value of LYU1212121) is contained or not in the JSON array in the response. You expect a Boolean result (true or false).
  2. You want to know at which index value the varLEADS_ID (with value of LYU1212121) is contained in the JSON array in the response. You expect a Number result (0,1,2,… or else -1 when not found)
  3. You want to grasp a JSON object, out of the JSON array in the response, of which LEADS_ID has value of LYU1212121. You expect a result of type java.lang.Object or null if not found.

These 3 problems require totally different codes to solve. There is no single magical keyword that applies to all 3 cases. So you should describe your problem more specifically.