简体   繁体   English

序列化 JavaScript 中的复杂对象

[英]Serializing complex objects in JavaScript

I would like to know if there are any libraries or tools that can serialize complex javascript objects to a string (that may contain functions, regex, etc.) that don't require the use of npm.我想知道是否有任何库或工具可以将复杂的 javascript 对象序列化为不需要使用 npm 的字符串(可能包含函数、正则表达式等)。

I've come across several different libraries for this purpose but they all required npm.为此,我遇到了几个不同的库,但它们都需要 npm。

Are there any good serialization libraries that don't require npm and are preferably written in pure vanilla JS?是否有任何不需要 npm 并且最好用纯香草 JS 编写的好的序列化库?

Npm is just a catalog of all of these pure vanilla js libraries. Npm 只是所有这些纯香草 js 库的目录。 You do not have to use npm to access them.您不必使用 npm 来访问它们。 The packages will usually have a link to the source code on github or something.这些包通常会有一个指向 github 或其他东西的源代码的链接。 Go to the source, clone the project, do whatever you need to. Go 到源代码,克隆项目,做任何你需要的事情。

Use the built in JSON.stringify() for a vanilla, no external dependencies, object parser.将内置的 JSON.stringify() 用于香草,没有外部依赖项,object 解析器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM