1.5.0 • Published 1 year ago

@ajoelp/json-to-formdata v1.5.0

Weekly downloads
237
License
MIT
Repository
github
Last release
1 year ago

JSON to FormData

Convert json data to a FormData object

Install

This project uses node. Install from their website

$ npm i @ajoelp/json-to-formdata

Usage

// Using ES6
import jsonToFormData from '@ajoelp/json-to-formdata';

// Using CommonJS
const jsonToFormData = require('@ajoelp/json-to-formdata');

// Use the package
const formData = jsonToFormData({
  foo: 'bar',
  bar: 'baz',
});

// With options
const formData = jsonToFormData({
  foo: 'bar',
  bar: 'baz',
}, {
  // Add indexes to arrays
  arrayIndexes: true,
  // Exclude nulls from data items
  excludeNull: true,
});

// Append an existing FormData Object
const formData = new FormData();
formData.append('key', 'value');

jsonToFormData({
  foo: 'bar',
  bar: 'baz',
}, {}, formData);

License

MIT License © Joel Podrebarac

1.5.0

1 year ago

1.4.0

2 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago