curl-to-json-convert

1.0.9 • Public • Published

Curl to Json

NEW UPDATE Added Multiple support to PARAMETERS

curl-to-json converts curl requests to JSON requests
Easy to use inside Frontend, no Backend support needed (Nodejs NPM packages)
Also Support For NPM (easy include using require("curl-to-json-convert"))
No Dependencies if Used Directly from Frontend(download from github)

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": "Harsh", "email": "harshsinghzero@gmail.com", "message": "Hello I am Harsh"}' \
https://github.com/HARSHSINGH0
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://github.com/HARSHSINGH0",
    "data": {
        "name": "Harsh",
        "email": "harshsinghzero@gmail.com",
        "message": "Hello I am Harsh"
    }
}

Usage If using NPM Package

var curlToJsonConvert = require("curl-to-json-convert")
console.log(curlToJsonConvert("curl www.example.com"))

Usage If using Direct Download for Frontend (No dependencies)

<script src="curl-to-json-object1.js"></script>
<script>

const curlCommand = "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": "Harsh", "email": "harshsinghzero@gmail.com", "message": "Hello I am Harsh"}' \
https://github.com/HARSHSINGH0";

console.log(curltojsonobject(curlCommand));

</script>

Author https://github.com/HARSHSINGH0

Package Sidebar

Install

npm i curl-to-json-convert

Weekly Downloads

6

Version

1.0.9

License

ISC

Unpacked Size

16.5 kB

Total Files

3

Last publish

Collaborators

  • harshsingh1