An open API service indexing awesome lists of open source software.

https://github.com/linck/jsontyped

Json to Typescript object converter
https://github.com/linck/jsontyped

json typescript

Last synced: about 1 month ago
JSON representation

Json to Typescript object converter

Awesome Lists containing this project

README

          

# Jsontyped

[![NPM](https://nodei.co/npm/jsontyped.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/protontype/)

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.json");

connect(config.port, config.databaseName);