JSON template

Generate JSONL data online

Generating JSONL data is useful in many areas of software development, data processing, machine learning, and many other fields. JSONL (JSON Lines), also known as NDJSON (Newline Delimited JSON), is a lightweight format in which each line contains a valid JSON value, usually a JSON object. Unlike standard JSON files, JSONL files do not require an enclosing array, making them particularly suitable for processing large datasets line by line.

Its line-oriented structure allows each record to be processed individually, without having to load the entire file into memory.

This online JSONL generator makes it easy to create JSON Lines files. Define your data structure using JavaScript expressions, then generate a .jsonl file with a single click. Each record is serialized as JSON and written on a separate line, ready to be used in your applications or scripts.

There are no artificial limits on the amount of data you can generate. The only limitations depend on your browser's available memory and processing capabilities.

Documentation

choice

choice('string1', 'string2', 'string3', ...)
Returns one of the strings passed as parameters.

random

random(min, max)
Returns a random integer.

  • Min and max are optional.
  • Min defaults to 0.
  • Max defaults to 2^53 -1.

randomFloat

randomFloat(min, max, scale)
Returns a random float.

  • Min, max, and scale are optional.
  • Min defaults to 0.
  • Max defaults to 2^53 -1.
  • Scale defaults to 2.

randomBool

randomBool()
Returns a random boolean.

repeat

repeat(numberOfTimes, elementToRepeat)
Duplicates an element and returns the result in an array.
Example: repeat(5, firstname())

date

date(format, from, to)
Returns a random date.

  • From and To are optional.
  • From defaults to 1900-01-01.
  • To defaults to 2100-01-01.

Examples:

  • date('Y-m-d H:i:s') returns '2001-03-10 17:16:18'
  • date('F j, Y, g:i a') returns 'March 10, 2001, 5:16 pm'
  • date('m.d.y') returns '03.10.01'
  • date('j, n, Y') returns '10, 3, 2001'
  • date('Ymd') returns '20010310'
  • date('D M j G:i:s T Y') returns 'Sat Mar 10 17:16:18 MST 2001'

For more details: PHP Date Manual

Regular expression

regex(regularExpression)
Returns a random string that matches a given RegExp Javascript object.
Example: regex(/hello+ (world|to you)/) can return 'helloooooooo world' or 'helloo to you'.
Uses randexp.js (MIT License).

Call a JavaScript function

function () { ... }
Returns the result of the function. 'this' represents the JSON object where the function is located.

expression

expression(exp)
Returns a string containing values from other columns of the current object.
Example: {{firstname}}.{{lastname}}.yopmail.com

index

index(start)
Returns the index of the element.

  • Start is optional.
  • Defaults to 0.

firstname

firstname()
Returns a random firstname.

lastname

lastname()
Returns a random lastname.

country

country()
Returns a random country.

countryCode

countryCode()
Returns a random country code (two characters).

city

city()
Returns a random city.