가독성을 위해 기존의 상수형태의 목데이터를 → json형태로 변환해서 저장하려고 하는데
json 파일로 변환하는 방법
1. const feedsList = [];
이런 상태였던 거를
→ { "feedsList" : [] }
형태로 바꾼다
2. 객체의 key는 문자열이기 때문에 -> 쌍따옴표로 감싼다
3. 따옴표는 홑따옴표는 안되고 오직 쌍따옴표만!
const feedsList = [
{
id: 4,
feedsProfileUrl: './images/eunjungPark/feeds-profile.png',
userId: 'eunJeong ',
feedsImageUrl: './images/eunjungPark/feeds-image.png',
mineProfileUrl: './images/eunjungPark/feeds-profile.png',
likeUserId: 'chunSig ',
likeUserNum: '10명',
commentTitText: '수호가 라이언을 좋아하는구나..!',
},
{
id: 5,
feedsProfileUrl: './images/eunjungPark/feeds-profile.png',
userId: 'eunJeong22 ',
feedsImageUrl: './images/eunjungPark/feeds-image.png',
mineProfileUrl: './images/eunjungPark/feeds-profile.png',
likeUserId: 'chunSig22 ',
likeUserNum: '20명',
commentTitText: '수호가 라이언을 좋아하는구나..!',
},
{
id: 6,
feedsProfileUrl: './images/eunjungPark/feeds-profile.png',
userId: 'eunJeong33 ',
feedsImageUrl: './images/eunjungPark/feeds-image.png',
mineProfileUrl: './images/eunjungPark/feeds-profile.png',
likeUserId: 'chunSig33 ',
likeUserNum: '30명',
commentTitText: '수호가 라이언을 좋아하는구나..!',
},
];
{
"feedsList": [
{
"id": 4,
"feedsProfileUrl": "./images/eunjungPark/feeds-profile.png",
"userId": "eunJeong ",
"feedsImageUrl": "./images/eunjungPark/feeds-image.png",
"mineProfileUrl": "./images/eunjungPark/feeds-profile.png",
"likeUserId": "chunSig ",
"likeUserNum": "10명",
"commentTitText": "수호가 라이언을 좋아하는구나..!"
},
{
"id": 5,
"feedsProfileUrl": "./images/eunjungPark/feeds-profile.png",
"userId": "eunJeong22 ",
"feedsImageUrl": "./images/eunjungPark/feeds-image.png",
"mineProfileUrl": "./images/eunjungPark/feeds-profile.png",
"likeUserId": "chunSig22 ",
"likeUserNum": "20명",
"commentTitText": "수호가 라이언을 좋아하는구나..!"
},
{
"id": 6,
"feedsProfileUrl": "./images/eunjungPark/feeds-profile.png",
"userId": "eunJeong33 ",
"feedsImageUrl": "./images/eunjungPark/feeds-image.png",
"mineProfileUrl": "./images/eunjungPark/feeds-profile.png",
"likeUserId": "chunSig33 ",
"likeUserNum": "30명",
"commentTitText": "수호가 라이언을 좋아하는구나..!"
}
]
}