⚔LiteMock

Documentation

Learn how to create powerful JSON templates with LiteMock

Quick Start

Create JSON templates using our simple syntax. Variables start with @ and follow the pattern @category.method

{
  "name": @person.firstName,
  "email": @internet.email,
  "age": @number.int(18, 65)
}

šŸŽ­ Faker.js Integration

Use any faker.js method with simple syntax

@person.firstName
@internet.email
@company.name

🧮 Parameter Support

Pass parameters to control output

@number.int(1, 100)
@lorem.words(5)
@date.past(2)

šŸ”— String Concatenation

Combine values with expressions

@person.firstName + " " + @person.lastName

šŸ”„ Array Repetition

Generate arrays with @repeat directive

[{ "id": @number.int }] @repeat(5)

šŸ—ļø Nested Structures

Support for complex nested objects and arrays

{
  "user": {
    "profile": {
      "address": {
        "street": "@location.streetAddress"
      }
    }
  }
}

Complete Example

Here's a comprehensive template showing all features:

{
  "users": [
    {
      "id": @number.int(1, 1000),
      "name": @person.firstName + " " + @person.lastName,
      "email": @internet.email,
      "age": @number.int(18, 65),
      "address": {
        "street": @location.streetAddress,
        "city": @location.city,
        "country": @location.country,
        "zipCode": @location.zipCode
      },
      "profile": {
        "bio": @lorem.paragraph,
        "avatar": @internet.avatar,
        "joinedAt": @date.past
      },
      "isActive": @datatype.boolean
    }
  ] @repeat(3),
  "meta": {
    "total": @number.int(100, 10000),
    "company": @company.name,
    "description": @lorem.paragraph
  }
}

Available Categories

āœˆļø Airline

  • aircraftType, airline
  • airplane, airport
  • flightNumber

🦁 Animal

  • bird, cat, dog
  • fish, horse, rabbit
  • snake, type

šŸ“š Book

  • author, format
  • genre, publisher
  • series, title

šŸŽØ Color

  • cmyk, hsl, rgb
  • human, space
  • hwb, lab, lch

šŸ›’ Commerce

  • department, isbn
  • price, product
  • productName

šŸ¢ Company

  • name, catchPhrase
  • buzzPhrase
  • catchPhraseNoun

šŸ—„ļø Database

  • column, collation
  • engine, type
  • mongodbObjectId

šŸ“Š Datatype

  • array, bigInt
  • boolean, datetime
  • json, uuid

šŸ“… Date

  • past, future
  • recent, soon
  • birthdate, month

šŸ’° Finance

  • account, amount
  • bitcoinAddress
  • creditCardNumber
  • currencyCode, iban

šŸ• Food

  • adjective, dish
  • fruit, ingredient
  • meat, spice

šŸ”€ Git

  • branch, commitSha
  • commitMessage
  • commitDate

šŸ’» Hacker

  • abbreviation
  • adjective, noun
  • phrase, verb

šŸ–¼ļø Image

  • avatar, dataUri
  • url, urlLoremFlickr
  • urlPicsumPhotos

🌐 Internet

  • email, userName
  • url, domainName
  • ip, password, mac

šŸ“ Location

  • city, country
  • streetAddress
  • zipCode, latitude

šŸ“ Lorem

  • word, words
  • sentence, paragraph
  • slug, text

šŸŽµ Music

  • artist, genre
  • songName

šŸ”¢ Number

  • int(min, max)
  • float, bigInt
  • binary, hex, octal

šŸ‘¤ Person

  • firstName, lastName
  • fullName, jobTitle
  • gender, bio

šŸ“± Phone

  • number, imei

šŸ”¬ Science

  • chemicalElement
  • unit

šŸ”¤ String

  • alpha, alphanumeric
  • binary, hexadecimal
  • uuid, nanoid

šŸ’¾ System

  • fileName, fileExt
  • filePath, mimeType
  • cron, semver

šŸš— Vehicle

  • bicycle, color
  • fuel, manufacturer
  • model, type, vin

šŸ“– Word

  • adjective, adverb
  • noun, verb
  • conjunction

šŸ› ļø Helpers

  • arrayElement
  • fake, maybe
  • shuffle, slugify