Best way to serialize/unserialize objects in JavaScript?

前端 未结 8 1407
忘掉有多难
忘掉有多难 2020-11-27 13:53

I have many JavaScript objects in my application, something like:

function Person(age) {
    this.age = age;
    this.isOld = function (){
        return thi         


        
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 14:18

    I've added yet another JavaScript serializer repo to GitHub.

    Rather than take the approach of serializing and deserializing JavaScript objects to an internal format the approach here is to serialize JavaScript objects out to native JavaScript. This has the advantage that the format is totally agnostic from the serializer, and the object can be recreated simply by calling eval().

    https://github.com/iconico/JavaScript-Serializer

提交回复
热议问题