auto-json-faker

1.0.8 • Public • Published

auto-json-faker

English日本語

auto-json-faker is a powerful library for transforming JSON and XML data into mock data, using schema generation to automate the process. Ideal for testing and development.

Features

  • Automatically parses JSON5 and XML inputs.
  • Generates realistic mock data.
  • Easy integration into development workflows.

Installation

Install the library using npm:

npm install auto-json-faker

Usage

Here’s how to use auto-json-faker in your project:

const autoJsonFaker = require('auto-json-faker');

// Example JSON input
const jsonString = `
{
    "name": "John Doe",
    "age": 30,
    "email": "john.doe@example.com"
}
`;

// Example XML input
const xmlString = `
<person>
    <name>John Doe</name>
    <age>30</age>
    <email>john.doe@example.com</email>
</person>
`;

// Generate mock data from JSON
autoJsonFaker(jsonString).then(mockData => {
    console.log('Generated Mock JSON:', mockData);
}).catch(error => {
    console.error('Error:', error);
});

// Generate mock data from XML
autoJsonFaker(xmlString).then(mockData => {
    console.log('Generated Mock XML:', mockData);
}).catch(error => {
    console.error('Error:', error);
});

API

autoJsonFaker(input, ai = false)

  • input (String): The JSON5 or XML string to be transformed into mock data.
  • ai (Boolean): Optional. Reserved for future use with AI capabilities.

Returns a Promise that resolves to the generated mock data, either as a JSON or XML string, depending on the input format.

License

This project is licensed under the MIT License.

Contributing

We welcome contributions! Please open an issue or submit a pull request on GitHub.

Support

For any questions or issues, please contact our team at support@example.com.

Acknowledgements


Happy coding with auto-json-faker! Mock data generation has never been this easy.

Readme

Keywords

Package Sidebar

Install

npm i auto-json-faker

Weekly Downloads

3

Version

1.0.8

License

MIT

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • apipost-lab001