remove duplicated json code example
Example 1: Remove Duplicate objects from JSON
//change is
while( $row = mysqli_fetch_array( $result ))
{
$response[] = $row;
}
//with this
while($row = mysqli_fetch_array($result))
{
$response['id'] = $row['id'];
$response['name'] = $row['name'];
$response['password'] = $row['password'];
$response['email'] = $row['email'];
}
Example 2: removing duplicates using json python
all_ids = [ each['obj_id'] for each in ds ]
unique_stuff = [ ds[ all_ids.index(id) ] for id in set(ids) ]