jsontyped
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Jsontyped

Load Json file in Typescript Object

How to use

Simple!

1. Create your json file:

myconfig.json

{
    "port": "3000",
    "databaseName": "teste"
}

2. Define your type:

export interface MyConfig {
    port: number;
    databaseName: String;
}

3. Load your json file and use:

import { JsonLoader } from "jsontyped";

var config: MyConfig = JsonLoader.loadFile<MyConfig>("./myconfig.json");

connect(config.port, config.databaseName);

Readme

Keywords

Package Sidebar

Install

npm i jsontyped

Weekly Downloads

1

Version

1.2.0

License

MIT

Last publish

Collaborators

  • linck