java-web/examples/chapter03/tasks/json-generator.md
2024-10-11 11:58:39 +08:00

907 B

使用json-generator生成假数据

website

https://json-generator.com/

user


[
  '{{repeat(10)}}',
  {
    id: '{{index(1)}}',
    avatar: 'https://loremflickr.com/120/120',
    nickName: '{{lorem(1, "word")}}',
    name: '{{firstName()}} {{surname()}}',
    email: '{{email()}}',
    phone: '+86 {{phone()}}',
    about: 'Hi, wellcome to my home. I am from {{country()}}. ',
    createDate: '{{date(new Date(2024, 0, 1), new Date(), "YYYY-MM-dd hh:mm:ss")}}'
  }
]

post

[
  '{{repeat(20)}}',
  {
    id: '{{index(1)}}',
    userId: '{{integer(1,10)}}',
    coverImage: 'https://loremflickr.com/640/320',
    thumbnail: 'https://loremflickr.com/240/320',
    title: '{{lorem(1)}}',
    body: '{{lorem(integer(1,4), "paragraphs")}}',
    comments: '{{integer(1,10)}}',
    createDate: '{{date(new Date(2024, 0, 1), new Date(), "YYYY-MM-dd hh:mm:ss")}}'
  }    
]