Convert HTML -> MobileDoc → Cannot read property 'map' of undefined

#1

image

I want to Convert HTML -> MobileDoc
html fields:
“html”: “<h2 id=“dear”><a href=“https://www.docs.wang”>dear”,

How to complete the conversion?

my JSON file:
{
“db”: [
{
“meta”: {
“exported_on”: 1555740526110,
“version”: “2.20.1”
},
“data”: {
“posts”: [
{
“id”: “5cbab3414795be2bd06ec752”,
“uuid”: “899cb2bb-4706-4c97-b6bb-4796056426cb”,
“title”: “dear”,
“slug”: “dear”,
“mobiledoc”: “”,
“html”: “<h2 id=“dear”><a href=“https://www.docs.wang”>dear”,
“comment_id”: “5cbab3414795be2bd06ec752”,
“plaintext”: “dear [https://www.docs.wang]”,
“feature_image”: null,
“featured”: 0,
“page”: 0,
“status”: “published”,
“locale”: null,
“visibility”: “public”,
“meta_title”: null,
“meta_description”: null,
“author_id”: “1”,
“created_at”: “2019-04-20T05:50:57.000Z”,
“updated_at”: “2019-04-20T05:51:28.000Z”,
“published_at”: “2019-04-20T05:51:28.000Z”,
“custom_excerpt”: “aaa”,
“codeinjection_head”: null,
“codeinjection_foot”: null,
“og_image”: null,
“og_title”: null,
“og_description”: null,
“twitter_image”: null,
“twitter_title”: null,
“twitter_description”: null,
“custom_template”: null,
“canonical_url”: null
}
],
“posts_authors”: [
{
“id”: “5cbab3414795be2bd06ec753”,
“post_id”: “5cbab3414795be2bd06ec752”,
“author_id”: “1”,
“sort_order”: 0
}
],
“posts_tags”: [
{
“id”: “5cbab35e4795be2bd06ec75c”,
“post_id”: “5cbab3414795be2bd06ec752”,
“tag_id”: “5cbab2504795be2bd06ec74b”,
“sort_order”: 0
}
],
“roles”: [
{
“id”: “5cb80ea84795be2bd06ec5f5”,
“name”: “Administrator”,
“description”: “Administrators”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
},
{
“id”: “5cb80ea84795be2bd06ec5f6”,
“name”: “Editor”,
“description”: “Editors”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
},
{
“id”: “5cb80ea84795be2bd06ec5f7”,
“name”: “Author”,
“description”: “Authors”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
},
{
“id”: “5cb80ea84795be2bd06ec5f8”,
“name”: “Contributor”,
“description”: “Contributors”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
},
{
“id”: “5cb80ea84795be2bd06ec5f9”,
“name”: “Owner”,
“description”: “Blog Owner”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
},
{
“id”: “5cb80ea84795be2bd06ec5fa”,
“name”: “Admin Integration”,
“description”: “External Apps”,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
}
],
“roles_users”: [
{
“id”: “5cb80eab4795be2bd06ec641”,
“role_id”: “5cb80ea84795be2bd06ec5f7”,
“user_id”: “5951f5fca366002ebd5dbef7”
},
{
“id”: “5cb80eac4795be2bd06ec713”,
“role_id”: “5cb80ea84795be2bd06ec5f9”,
“user_id”: “1”
}
],
“tags”: [
{
“id”: “5cbab2504795be2bd06ec74b”,
“name”: “Getting Started”,
“slug”: “getting-started”,
“description”: null,
“feature_image”: null,
“parent_id”: null,
“visibility”: “public”,
“meta_title”: null,
“meta_description”: null,
“created_at”: “2019-04-18T05:44:08.000Z”,
“updated_at”: “2019-04-18T05:44:08.000Z”
}
]
}
}
]
}

#2

@xiongchao hi! If you are converting this exact HTML:

<h2 id=“dear”><a href=“https://www.docs.wang”>dear

then it won’t work because it’s invalid markup (lacking closing tags). You can try running the same script with:

<h2 id=“dear”><a href=“https://www.docs.wang”>dear</a><h2>
closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.