Typescript Change Last Element Of Array Json Php