Gathering detailed insights and metrics for mock-json-data
Gathering detailed insights and metrics for mock-json-data
Gathering detailed insights and metrics for mock-json-data
Gathering detailed insights and metrics for mock-json-data
npm install mock-json-data
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Oct 16, 2017
Latest Version
1.0.0
Package Id
mock-json-data@1.0.0
Size
5.41 kB
NPM Version
5.4.2
Node Version
8.6.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
3
A easy use mock json data generator npm cli tool for front-end engineer.
1$ npm install -g mock-json-data
1$ mock <schema-file> <output-file-name>
A schema file defines the structure of data. It is a object array. A simple schema looks like this:
1[ 2 { 3 "key":"code", 4 "type":"enum", 5 "value":[-1,1,0] 6 }, 7 { 8 "key":"message", 9 "type":"exactly", 10 "value": "success" 11 }, 12 { 13 "key":"lists", 14 "type":"array", 15 "length":10, 16 "schema":[ 17 { 18 "key":"id", 19 "type":"index", 20 "start":100, 21 }, 22 { 23 "key":"Week", 24 "type":"enum", 25 "value":["Mon","Tue","Wen","Thu","Fri"] 26 } 27 ] 28 } 29]
key
and type
is required for every object. key
is the property name of data and type tells how to generate data. Currently, type is one of ['index', 'number', 'exactly', 'enum', 'word', 'sentence', 'date', 'object', 'array']
, each type can have some other property.
index
: auto increase for index purpose
start
: the start index, should be a number, optional, default = 0number
: generate number data
range
: the range of generate number, array with two number inside, optional, default = [0,10]decimal
: the decimal of number, should be a number, optional, default = 0exactly
: generate an exactly given value
value
: the value need to generate, requiredenum
: choose one from given array value randomly
value
: the collection of enum, should be an array, required, eg: ["Mon","Tue","Wen","Thu","Fri"]
word
: generate some lorem ipsum words, powered by lorem-ipsum.js
length
: the amount of words, should be a number, optional, default = 10sentence
: generate some lorem ipsum sentence, powered by lorem-ipsum.js
length
: the amount of sentence, should be a number, optional, default = 5date
: generate date type data
range
the range of generate date, array with two date inside, optional, default = ['1970-0-1',now]format
: format of date, optional , default = 'yyyy/mm/dd', check node-dateformat for more types of formatobject
: generate object data
schema
: the sub-schema of object, the rule is same as schema, requiredarray
: generate array(list,collection) data
length
: the length of array, should be number, requiredschema
: the sub-schema of array, the rule is same as schema, requiredNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More