티스토리 뷰
728x90
반응형
JSON에서 원하는 값을 parsing 한 후에 중복 값 제거하기
const myArray = [
{ "id" : "1", "name" : "sskim", "country" : "korea" },
{ "id" : "2", "name" : "lsy", "country" : "usa" },
{ "id" : "3", "name" : "lsw", "country" : "canada" },
{ "id" : "1", "name" : "sskim", "country" : "korea" },
{ "id" : "5", "name" : "nyw", "country" : "australia" },
{ "id" : "5", "name" : "kjh", "country" : "italia" }
];
const unique = myArray.map(function (val, index) {
return val['id'];
}).filter(function (val, index, arr) {
return arr.indexOf(val) === index;
});
console.log(unique);
728x90
반응형
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- k8s
- localtime
- input
- springboot
- jQuery
- 베리 심플
- LocalDateTime
- window
- rocky
- docker
- Bash tab
- maven
- intellij
- mybatis config
- Spring Security
- elasticsearch
- Mac
- Spring
- 오라클
- JavaScript
- config-location
- claude
- oracle
- Linux
- mybatis
- Java
- LocalDate
- Kotlin
- svn
- 북리뷰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함
반응형