• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

[추가질문] 자료구조 2개 합치기

22.04.07 11:17 작성 조회수 111

0


 
 
제가 질문을 드릴 때 설명이 부족했나 봅니다.

 

입력과 출력은 아래와 같습니다. 기존에는 2중 for문을 함수형으로 변경을 하고 싶습니다.
 
 
// 입력 1 (로컬 디파인값)
 {
  "free1": {
  "displayName": "자유게시판",
  "description": " 참여공간 자유게시판"
  },
  "pds1": {
  "displayName": "자료실",
  "description": "정보자료실 (디지털자료실 제외)"
  },
  "review1": {
  "displayName": "유저사용기",
  "description": "유저분들을 위해 리뷰 · 활용비법을 게시"
  },
  "review2": {
  "displayName": "자유사용기",
  "description": "사용자 팁/사용기 아무거나 질문답변 · 토론의 장"
  }
 } 
 
 
// 입력 2 (서버 호출 결과)
{
"code": 200,
"message": "ok",
"data": [{
"groupId": "1",
"groupName": "community",
"groupTitle": "커뮤니티",
"categories": [{
"no": "free1",
"displayName": "",
"description": "",
"attributeId": "/l/free",
"categorySkin": "lnbboard"
}, {
"no": "pds1",
"displayName": "",
"description": "",
"attributeId": "/l/pds",
"categorySkin": "pds"
}]
}, {
"groupId": "8",
"groupName": "information",
"groupTitle": "인포메이션",
"categories": [{
"no": "review1",
"displayName": "",
"description": "",
"attributeId": "/l/user_review",
"categorySkin": "user_review"
}, {
"no": "review2",
"displayName": "",
"description": "",
"attributeId": "/l/common_review",
"categorySkin": "common_review"
}]
}]
}
 


// 출력 (displayName와 description값을 로컬값에서 찾아와서  서버 결과값에 적용합니다.)  
 [{
"groupId": "1",
"groupName": "community",
"groupTitle": "커뮤니티",
"categories": [{
"no": "free1",
"displayName": "자유게시판",
"description": "참여공간 자유게시판",
"attributeId": "/l/free",
"categorySkin": "lnbboard"
}, {
"no": "pds1",
"displayName": "자료실",
"description": "정보자료실 (디지털자료실 제외)",
"attributeId": "/l/pds",
"categorySkin": "pds"
}]
}, {
"groupId": "8",
"groupName": "information",
"groupTitle": "인포메이션",
"categories": [{
"no": "review1",
"displayName": "유저사용기",
"description": "유저분들을 위해 리뷰 · 활용비법을 게시",
"attributeId": "/l/user_review",
"categorySkin": "user_review"
}, {
"no": "review2",
"displayName": "자유사용기",
"description": "사용자 팁/사용기 아무거나 질문답변 · 토론의 장",
"attributeId": "/l/common_review",
"categorySkin": "common_review"
}]
}]
 
 

답변 1

답변을 작성해보세요.

0

free1 pds1 등을 기준으로 연결해주는건가보네요.

이중 for문 혹은 이중 each를 돌면서 매칭해주는게 맞아보입니다 :)