[Solved] How to parse JSON data and eliminate duplicates in Swift?


You can do as

var ph = [String]()
var newjson = [[String:String]]()

    for dict in json {
        if ph.contains(dict["Phone"]!) {

            print("duplicate phone \(dict["Phone"]!)")

        } else {

        ph.append(dict["Phone"]!)
        newjson.append(dict)

        }
    }
    print(newjson)

Hare newjson is the new array of dictionary that do not have duplicate phone

solved How to parse JSON data and eliminate duplicates in Swift?