Contentful logo

Contentful Community

Migration - parseHtml - error - The type of \"content\" is incorrect, expected type: Array

Hi all,

I need to migrate the content of a text field (containing HTML tags) to another Rich text field. I am using the parseHtml in contentful-html-rich-text-converter as:

    const intro = fromFields.introduction['en-US'];
	const content1 = parseHtml(intro);
	// The returned Rich Text object
	var result = {
	  introduction2: {
		data: {},
		content: content1,
		nodeType: 'document'
	  }
	};
	return result;

But while running the migration query, it gives the error:

InvalidEntry: {
“status”: 422,
“statusText”: “Unprocessable Entity”,
“message”: “Validation error”,
“details”: {
“errors”: [
{
“name”: “type”,
“details”: “The type of “content” is incorrect, expected type: Array”,
“path”: [
“fields”,
“introduction2”,
“en-US”,
“content”
],
“type”: “Array”,
“value”: {
“data”: {},
“content”: [
{
“data”: {},
“marks”: [],
“value”: “Test data”,
“nodeType”: “text”
},
{
“data”: {},
“content”: [
{
“data”: {},
“marks”: [],
“value”: “Test data2”,
“nodeType”: “text”
}
],
“nodeType”: “paragraph”
}
],
“nodeType”: “document”
}
}
]
}

Can somebody help in resolving this?

Thanks.