🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

jerialize

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jerialize

A Typescript json (de)serializer

latest
npmnpm
Version
1.0.12
Version published
Maintainers
1
Created
Source

#Jerialize

Preperation

Nodejs:

npm install jerialize --save

Systemjs:

jspm install npm:jerialize

Usage

import * as jerialize from "jerialize";
class MyClass{

    @jerialize.serialize()
    public simpleProperty: string;
    @jerialize.serialize()
    public simpleArray: Array<string>;
    @jerialize.serialize({type: AnotherClass}) //Providing the type is required
    public objectProperty: AnotherClass;
    @jerialize.serialize({type: AnotherClass}) //Providing the type is required, arrays are autodetected
    public objectArray: Array<AnotherClass>;
    
    constructor(){ // The constructor has to be without parameters or each parameter has to be optional
        ...
    }

}
var jerializer.Serializer = new jerializer.Serializer();
var testObj: MyClass = new MyClass();
//fill the fields of testObj
var serialized: string = <string>serializer.serialize(testObj,true);
var deserialized: MyClass = serializer.deserialize<MyClass>(MyClass,serialized);

FAQs

Package last updated on 08 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts