Forum Discussion

Tanmay_Sarkar's avatar
Tanmay_Sarkar
New Contributor III
5 years ago
Solved

Remove duplicate values from the JSON array

Hello All, Hi, I have a JSON array and I have to remove the duplicates based on a field and then I want the non duplicate elements in one array and the duplicate values in an another array. Input...
  • viktor_n's avatar
    viktor_n
    4 years ago

    But if those numbers are between quote it means that it is string.

    723456 and “723456” is not same.

    See if this will help you to determine if it’s number or string.
    $input.toString().match(/^\d+$/) != null ? true : false
    This expression will check if value of input contains only numbers and if it is, then will return true, otherwise if not contains only numbers it will return false.

    To check for string it’s opposite, you need to switch the places of true and false.

    Regards,
    Viktor