json2tstool
v1.0.7
Published
transform json to typescript interface
Downloads
29
Readme
转换JSON字符串为TypeScript Interface字符串
demo 演示
安装
npm i json2tstool
使用
In Browser
<script src="https://unpkg.com/[email protected]/dist/index.global.js"></script>
const jsonStr = `{ "key" : 2 }`;
json2tstool.default(jsonStr);
ES Module
import json2ts from 'json2tstool';
const jsonStr = `{ "key" : 2 }`;
json2ts(jsonStr);
NodeJS
const json2ts = require('json2tstool');
const jsonStr = `{ "key" : 2 }`;
json2ts(jsonStr);
命令行
# 输入json字符串
json2ts -i '{ "key" : 2 }'
# 指定输入文件地址
json2ts -f 'path to your json'
# 指定输出文件地址
json2ts -o 'a.ts'
支持一下
如果该库对你有帮助,可以点一下 ⭐️!