Curl to JSON Tool

Convert curl commands to JSON format for quick analysis and processing of HTTP requests

Table of Contents

Online Converter

Paste your curl command in the input box below, click the "Convert" button to get structured JSON format. Supports various complex curl parameters and options.

Enter curl command

JSON Result

// Conversion result will be displayed here

API Documentation

This tool provides a simple and easy-to-use API interface that can be integrated into your application for automated curl command parsing and conversion.

Endpoint

Use the following HTTP request method and path to access the API:

POST /api/convert

Request Format

The request body should be in JSON format, containing a curl field with the curl command string to be parsed:

{
    "curl": "your curl command here"
}

Response Format

The response content is a structured JSON object containing the following fields:

  • method: HTTP request method
  • url: Request URL
  • headers: Request headers
  • data: Request data
{
    "method": "POST",
    "url": "https://curl-to.com",
    "headers": {
        "Content-Type": "application/json"
    },
    "data": {
        "key": "value"
    }
}

Example Code

Here are examples of calling this tool's API in different programming languages:

fetch('/api/convert', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        curl: 'curl -X POST https://curl-to.com -H "Content-Type: application/json" -d \'{"key":"value"}\''
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests
import json

url = "http://curl-to.com/api/convert"
payload = {
    "curl": 'curl -X POST https://curl-to.com -H "Content-Type: application/json" -d \'{"key":"value"}\''
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
curl -X POST http://curl-to.com/api/convert \
  -H "Content-Type: application/json" \
  -d '{"curl": "curl -X POST https://curl-to.com -H \"Content-Type: application/json\" -d \"{\\\"key\\\":\\\"value\\\"}\""}' 

About Curl to JSON Tool

Curl to JSON Tool is an online utility designed specifically for developers, aimed at simplifying API debugging and HTTP request analysis. By converting complex curl commands into structured JSON format, developers can more easily understand and process HTTP requests.

Key Features

  • Fast Conversion - Convert curl commands to JSON format instantly
  • Comprehensive Parsing - Support for various curl parameters such as request methods, headers, data, etc.
  • API Interface - Provides a simple and easy-to-use API for integration with other systems
  • User Friendly - Intuitive interface design and interaction experience

Use Cases

  • API Development and Testing
  • Network Request Debugging
  • Automation Script Writing
  • Learning HTTP Protocol