当前位置:网站首页>Map,String,Json之間轉換
Map,String,Json之間轉換
2022-06-30 08:08:00 【homehome...】
- Map–>String
const map = new Map([
[‘name’, ‘Tom’],
[‘country’, ‘Chile’],
]);
// Convert to JSON string
const jsonStr = JSON.stringify(Object.fromEntries(map));
// ️ ‘{“name”: “Tom”, “country”: “Chile”}’
//將string --> Object --> Map
const obj = JSON.parse(jsonStr);
const mapAgain = new Map(Object.entries(obj));
console.log(mapAgain); // ️ {‘name’ => ‘Tom’, ‘country’ => ‘Chile’}
边栏推荐
- Development technology sharing of Jingtan NFT digital collection system
- Palindrome substring, palindrome subsequence
- Dlib database face
- Experiment 3 remote control
- F12抓包用于做postman接口测试的全过程解析
- 电流探头的干扰源电流谱测试
- Qqquickpainteditem implements graffiti program drawing board
- Cesium learning notes (VI) particle system
- Redis设计与实现(八)| 事务
- Markdown支持的emoji图标
猜你喜欢

Environment configuration of ROS Aubo manipulator

AcrelEMS能效管理平台为高层小区用电安全保驾护航

Oracle expansion table space installed in docker

Do you know the IP protocol?

What management improvements can CRM bring to enterprises

How to handle the expired data of redis and what are the elimination mechanisms?

Wechat applet reports errors using vant web app

Hit the industry directly | the flying propeller launched the industry's first model selection tool

增强for循环的增删操作 & 迭代器删除集合元素

Full stack performance testing theory - Summary
随机推荐
Deep learning -- recurrent neural network
多快好省,低门槛AI部署工具FastDeploy测试版来了!
【NVMe2.0b 14】NVMe Admin Command Set
Deep learning - residual networks resnets
Opencv4.2.0+vs2015 configuration
Wsl2 using GPU for deep learning
Rendering engine development
Emoji icons supported by markdown
C preliminary chapter learning route
Markdown支持的emoji图标
Cesium learning notes (VI) particle system
1163 Dijkstra Sequence
CRM&PM如何帮助企业创造最优销售绩效
[JUC series] overview of fork/join framework
How CRM & PM helps enterprises create optimal sales performance
vulfocus入门靶机
The counting tool of combinatorial mathematics -- generating function
Redis设计与实现(六)| 集群(分片)
1. Problems related to OpenGL window and environment configuration
Bingbing learning notes: quick sorting