**you can see my json Sanity schema **
{
title: "User Information",
name: "userinformation",
type: "array",
of: [
{
title: "User Answer",
name: "useranswer",
type: "object",
fields: [
{
title: "User",
name: "user",
type: "reference",
to: [
{
type: "profile"
}
]
},
{
title: "Answer",
name: "answer",
type: "string"
},
{
title: "Hearts",
name: "hearts",
type: "array",
of: [
{
type: "string"
},
]
},
]
},
]
},
so I am trying to by POST method append array into array..you can see my Nextjs API
const { post_id, user_uid, _rev, answer } = JSON.parse(req.body)
try {
await client
.patch(post_id)
.setIfMissing({
userinformation: [{
hearts: []
}]
})
// Add the items after the last item in the array (append)
.append('userinformation', [{
hearts: [user_uid]
}
])
.commit({
})
res.status(200).json({ post_id })
} catch (error) {
console.log(error);
res.status(500).json({ error })
}
This is create new array...but I need to check an array and append new array into this.. I think you understand it...what I want...I just want append new array without create outside array...my this code create new array but i don't want it...
here is sanity vision screenshot for better understanding

