如何正确读取包含unicode的instagram数据(saved_collections.json)

问题描述 投票:0回答:1

这是示例 json 内容

{
    "saved_saved_collections": [
        {
            "title": "Collection",
            "string_map_data": {
                "Name": {
                    "value": "\u00f0\u009f\u0091\u0080 Perspective"
                },
                "Creation Time": {
                    "timestamp": 1642495509
                },
                "Update Time": {
                    "timestamp": 1712848048
                }
            }
        },
        {
            "string_map_data": {
                "Name": {
                    "href": "https://www.instagram.com/reel/C51BfqFSwok/",
                    "value": "sadhguru.archives"
                },
                "Added Time": {
                    "timestamp": 1713616459
                }
            }
        },
}
}
javascript json unicode instagram
1个回答
0
投票
  • 如果您的文件包含 unicodes (\u),您必须读取它的二进制文件并转换它们
const text = "A\u00c5\u009f\u00c4\u00b1r\u00c4\u00b1 \u00c3\u0096nemli"
Buffer.from(text, "binary").toString("utf8") // 'Çok önemli'
© www.soinside.com 2019 - 2024. All rights reserved.