Skip to content

xietiansheng/json-to-any

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-to-any

支持json转换任意代码格式,支持层级嵌套生成

安装

npm install json-to-any --save

使用

请参考 example 文件夹下js演示代码

import { parse } from "json-to-any";

// 支持js对象
// 支持json数据
const jsonCode = {
  name: "Jack",
  age: 20,
  car: {
    brand: "BMW",
  }
};

const entityList = parse(jsonCode);

const result = transformCode(entityList, {
  default({ property }) {
    // 默认行为
  },
  array({ property }) {
    // 数组类型处理
  },
  before({ entity }){
    // 实体前置代码
  },
  after({ entity }) {
    // 实体后置代码
  },
});

About

npm package json-to-any

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published