当前位置:网站首页>Conversion between map, string and JSON
Conversion between map, string and JSON
2022-06-30 08:19: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”}’
// Will string --> Object --> Map
const obj = JSON.parse(jsonStr);
const mapAgain = new Map(Object.entries(obj));
console.log(mapAgain); // ️ {‘name’ => ‘Tom’, ‘country’ => ‘Chile’}
边栏推荐
- 【NVMe2.0b 14-3】Doorbell Buffer Config command、Device Self-test command
- Niuke White Moon race 52
- [nvme2.0b 14-7] set features (Part 1)
- Want to change careers, but don't know what to do? This article is written for you who are confused
- 直击产业落地 | 飞桨重磅推出业界首个模型选型工具
- 2021-02-19
- 微信公众号第三方平台开发,零基础入门。想学我教你啊
- 【NVMe2.0b 14-4】Directive Send/Receive command
- tp5设置直接下载文件
- Unit Test
猜你喜欢

An example of a single service in a cloud project driven by a domain

2021-05-06

Development technology sharing of Jingtan NFT digital collection system

电流探头的干扰源电流谱测试

Cesium learning notes (VI) particle system

Environment configuration of ROS Aubo manipulator

【NVMe2.0b 14-1】Abort、Asynchronous Event Request、Capacity Management command

Cesium learning notes (III) creating instances

1. Problems related to OpenGL window and environment configuration

Swagger use
随机推荐
Cesium learning notes (IV) visual image & Terrain
从0开始构建一个瀚高数据库Docker镜像
1. Problems related to OpenGL window and environment configuration
【NVMe2.0b 14-3】Doorbell Buffer Config command、Device Self-test command
[nvme2.0b 14 - 5] commande de téléchargement / commande du logiciel
mysql无法连接内网的数据库
JS代码案例
Redis设计与实现(六)| 集群(分片)
TP5 set direct download file
C# Console. Writeline() function output format
Unity 基础光照模型
Construction of module 5 of actual combat Battalion
Full stack performance testing theory - Summary
Unit Test
Acreems energy efficiency management platform escorts the power safety of high-rise residential areas
Redis设计与实现(三)| 服务器与客户端的交互(事件IO模型)
Want to change careers, but don't know what to do? This article is written for you who are confused
2021-02-19
Qqquickpainteditem implements graffiti program drawing board
Swagger use