JSPM

curl-to-json-object

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 217
  • Score
    100M100P100Q81295F
  • License MIT

convert curl request to json object

Package Exports

  • curl-to-json-object

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (curl-to-json-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Curl to Json

curl-to-json converts curl requests to JSON requests

Example

Curl
curl -X POST -H "Content-Type: application/json" \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Accept-Language: en-US,en;q=0.8,da;q=0.6' \
-d '{"name": "tolustar", "email": "info@tolustar.com", "message": "Hello I am Tolu"}' \
https://tolustar/contact
Json
{
  header: {
    'Content-Type': 'application/json',
    'Accept-Encoding': 'gzip, deflate',
    'Accept-Language': 'en-US,en;q=0.8,da;q=0.6'
  },
  method: 'POST',
  url: 'https://tolustar/contact',
  data: {
    name: 'tolustar',
    email: 'info@tolustar.com',
    message: 'Hello I am Tolu'
  }
}

Usage

npm install curl-to-json-object
const curl_to_json = require('curl-to-json-object')

const curl_request = 'curl -X POST -H "Content-Type: application/json" \ -H 'Accept-Encoding: gzip, deflate' \ -H 'Accept-Language: en-US,en;q=0.8,da;q=0.6' \ -d '{"name": "tolustar", "email": "info@tolustar.com", "message": "Hello I am Tolu"}' \ https://tolustar/contact'

console.log( curl_to_json(curl_request) )

Author https://tolustar.com