Socket
Socket
Sign inDemoInstall

@ajoelp/json-to-formdata

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ajoelp/json-to-formdata

Convert json data to a FormData object


Version published
Weekly downloads
463
increased by5.47%
Maintainers
1
Install size
1.38 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 20 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc