I am using github api and got the content of manifest.json file.
I am trying to add some new json lines into that existing json folder.
This the old content which is existing
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
this is the expected content output , after adding those new json contents it should look like this
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "maskable.png",
"sizes": "280x280",
"type":"image/png",
"purpose": "any maskable"
},
{
"src": "logo192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "logo256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "logo348.png",
"sizes": "348x348",
"type": "image/png"
},
{
"src": "logo512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
I tried string.replace but it is not working
let newContent = oldContent.replace(`{"src": "favicon.ico","sizes": "64x64 32x32 24x24 16x16","type": "image/x-icon"},`,
`{"src": "logo256.png","sizes": "256x256","type": "image/png"},{"src": "logo348.png","sizes": "348x348", "type": "image/png"},`);