百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
J

jsf

> 后端框架
开源

从 JSON 方案创建虚假 JSON 文件

200 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

从 JSON 方案创建虚假 JSON 文件

jsf

Use jsf along with fake data generators to provide consistent and meaningful fake data for your system.

Main Features

  • Provides out of the box data generation from any JSON schema
  • Extendable custom data providers using any lambda functions
  • Multi level state for dependant data (eg multiple objects sharing value, such as children with same surname)
  • Inbuilt validation of fake JSON produced ✅
  • In memory conversion from JSON Schema to Pydantic Models with generated examples
  • Seamless integration with FastAPI

Installation

Usage

Basic

python
from jsf import JSF

faker = JSF(
    {
        "type": "object",
        "properties": {
            "name": {"type": "string", "$provider": "faker.name"},
            "email": {"type": "string", "$provider": "faker.email"},
        },
        "required": ["name", "email"],
    }
)

fake_json = faker.generate()

Results in ...

python
{
    'name': 'Jesse Phillips', 
    'email': '[email protected]'
}

From JSON file

python
from jsf import JSF

faker = JSF.from_json("demo-schema.json")
fake_json = faker.generate()

Or run straight from the commandline...

Native install

bash
pip install jsf[cli]
jsf --schema jsf/tests/data/custom.json --instance wow.json

Docker

bash
docker run -v $PWD:/data challisa/jsf jsf --schema /data/custom.json --instance /data/example.json

FastAPI Integration

Create a file main.py with:

python
from jsf import JSF
from fastapi import FastAPI

app = FastAPI(docs_url="/")
generator = JSF.from_json("custom.json")

@app.get("/generate", response_model=generator.pydantic())
def read_root():
    return generator.generate()

Run the server with:

Partially supported features

  • string contentMediaType - only a subset of these are supported, however they can be expanded within this file

Credits

  • This repository is a Python port of json-schema-faker with some minor differences in implementation.

License

  • MIT License

Issues· 30 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythoncommandlinefakerfastapijsf

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架