根据条件 JSON 生成随机 JSON randomjson
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/finance-sh/randomjson
- 软件文档: https://github.com/finance-sh/randomjson/blob/master/README.md
软件介绍
randomjson,前端 mock 利器。可根据条件 json 生成随机 json。
用法
// 在amd,cmd环境中,引用包,在浏览器中无需引用
var randomjson = require('randomjson');
// 模型
var modelJson = {
"code": "00",
"numberCode": "<@[10000,20000]>",
"msg": "<@chinese{12,50}>",
"msg2": "<@string{2,3}>",
"logo": "<@image{100,100}>",
"result": {
"pList<@{1,3}>":[
{
"indexToString": "<@index><@>",
"index": "<@index>",
"id": "<@[1-5]>",
"price": "<@float>",
"name": "公司名称<@index>",
"person": "李文武<@index>",
"address": "北京市海淀区西三旗",
"mobile": "1<@number{10}>",
"tel": "<@number{4}>-<@number{8}>",
"list": [
{
"auditKey": 1,
"auditValue": "<@[0,1,2]>"
},
{
"auditKey": 2,
"auditValue": "<@[0,1,2]>"
}
]
}
]
}
}
// 根据模型生成json
var myJson = randomjson(modelJson);
根据上边模型生成的json可能是这样:
{
"code": "00",
"numberCode": 10000,
"msg": "加义为边平压你治提用根治问求只或程干立农资特",
"msg2": "dv",
"logo": "https://dummyimage.com/100x100",
"result": {
"pList": [
{
"indexToString": "1",
"index": 1,
"id": 2,
"price": 93.78,
"name": "公司名称1",
"person": "李文武1",
"address": "北京市海淀区西三旗",
"mobile": "17929438781",
"tel": "1148-56055642",
"list": [
{
"auditKey": 1,
"auditValue": 0
},
{
"auditKey": 2,
"auditValue": 1
}
]
},
{
"indexToString": "2",
"index": 2,
"id": 5,
"price": 29.49,
"name": "公司名称2",
"person": "李文武2",
"address": "北京市海淀区西三旗",
"mobile": "17826945504",
"tel": "7298-46226026",
"list": [
{
"auditKey": 1,
"auditValue": 0
},
{
"auditKey": 2,
"auditValue": 0
}
]
}
]
}
}
ActionScript 3.0精彩范例词典
杨东昱 编 / 2008-5 / 59.00元
《ActionScript 3.0精彩范例词典》列出了最常用的ActionScript语法,并附有详细的程序代码范例,不但教您如何使用、修改ActionScript代码,而且还以实际范例和图解,说明每项语法还能呈现哪些动画效果和功能,对学习ActipScript有所帮助。读者在阅读《ActionScript 3.0精彩范例词典》之后,将能开发出属于自己的ActionScript程序与FLASH动画......一起来看看 《ActionScript 3.0精彩范例词典》 这本书的介绍吧!
图片转BASE64编码
在线图片转Base64编码工具
正则表达式在线测试
正则表达式在线测试
