Skip to content

Serialize Private Arguments via prefix (defaults to "_") #1

Description

@johnstrickler

Many classes use private variables that are prefixed with an underscore. These are exposed using getters/setters. The JSON payload doesn't use underscores.

This library should allow for automatic checking and serialization.

Example -

Getters and Setters

 class Bar {

   constructor(private _foo: string} {
 
   }
  
   get foo() { return this._foo; };

   }
}

Usage:

let bar = TSON.parse('{"foo":"something"}', Bar);

// "foo" serializes directly into Bar's _foo property
bar.foo == 'something'; // is true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions