Placeholder Monster Documentation
Here you can find all the documentation for Placeholder Monster features
JSON Generator
The JSON template syntax in Placeholder Monster allows you to dynamically generate structured JSON data by using placeholders for various types of data. These placeholders represent functions that generate random, realistic, or controlled values for your JSON structure.
With this approach, you can create mock data that mimics real-world scenarios, making it ideal for testing APIs, building prototypes, or simulating datasets.
Key Features and Syntax
- Dynamic Placeholders: Placeholders are wrapped in double curly braces:
{{placeholder()}}
. They represent functions that generate data dynamically. - Flexibility: Combine placeholders with static data to generate structured, semi-randomized content.
- Repeat Blocks: Use
{{repeat(n)}}
to generate an array withn
items, where each item follows the defined structure.
Example Template Breakdown
Template:
{
"_id": "{{guid()}}",
"name": "{{firstName()}} {{lastName()}}",
"isActive": "{{bool()}}",
"balance": "{{money(1000, 4000)}}",
"age": "{{integer(20, 40)}}",
"address": {
"street": "{{street()}}",
"city": "{{city()}}",
"state": "{{state()}}",
"latitude": "{{latitude()}}",
"longitude": "{{longitude()}}"
},
"friends": [
"{{repeat(3)}}",
{
"id": "{{guid()}}",
"name": "{{firstName()}} {{lastName()}}"
}
]
}
Explanation:
{{guid()}}
: Generates a unique identifier for each object (e.g.,_id
andfriends.id
).{{firstName()}}
and{{lastName()}}
: Generates realistic first and last names.{{bool()}}
: Returns a random boolean value (true
orfalse
).{{money(min, max)}}
: Generates a random monetary value betweenmin
andmax
(e.g., balance).{{integer(min, max)}}
: Generates a random integer within the given range (e.g., age).{{street()}}
,{{city()}}
, and{{state()}}
: Returns realistic street, city, and state names.{{latitude()}}
and{{longitude()}}
: Generates random geographical coordinates.{{repeat(n)}}
: Creates an array ofn
items (e.g., thefriends
array).
How It Works
- Input Template: You define a JSON structure with placeholders that represent the type of data you need.
- Data Generation: When the template is processed, each placeholder is replaced with generated data. The functions ensure that the output mimics real-world scenarios.
- Output Example: For the template above, a possible output could look like this:
{ "_id": "e6d3a790-cf6e-4b99-a41e-3cf73cfc9235", "name": "John Doe", "isActive": true, "balance": 2578.23, "age": 34, "address": { "street": "123 Main St", "city": "Springfield", "state": "CA", "latitude": "34.0522", "longitude": "-118.2437" }, "friends": [ { "id": "b4f77a30-2df3-4cb9-841c-86f6b7ef1d59", "name": "Alice Smith" }, { "id": "d9a2f6d0-3f6e-4b87-841c-12f2b1e9e0a3", "name": "Bob Johnson" }, { "id": "fbd7a83b-c4e1-4d23-9b41-99f9a0c12b73", "name": "Charlie Brown" } ] }
Key Benefits
- Realistic Data: Generates realistic data like names, addresses, and IDs to match real-world scenarios.
- Customizable: Supports fully customizable templates, allowing you to tailor the structure and data types to your needs.
- Efficiency: Quickly simulate large datasets with nested objects, arrays, and dynamic values.
- Ease of Use: Intuitive syntax makes it easy to define templates, even for complex JSON structures.
Use Cases
- Testing APIs with realistic JSON payloads.
- Simulating large datasets for performance testing.
- Prototyping applications that require dynamic or semi-random data.
- Quickly generating mock data for presentations or demos.