JSON to CSV Converter API - Ruby Gem
JSON to CSV Converter is a powerful tool for converting JSON arrays into CSV format. It supports custom delimiters, header inclusion, and proper escaping of special characters.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_jsontocsv'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_jsontocsv
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_jsontocsv'
# Initialize the client
client = APIVerve::Jsontocsv::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
json: [object Object],[object Object],
delimiter: ",",
include_header: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ json: [object Object],[object Object], delimiter: ",", include_header: true })
puts response["data"]
rescue APIVerve::Jsontocsv::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Jsontocsv::APIError => e
puts "API error: #{e.message}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Jsontocsv::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"row_count": 2,
"column_count": 3,
"columns": [
"name",
"age",
"city"
],
"csv": "name,age,city\nJohn Doe,30,New York\nJane Smith,25,Los Angeles"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/jsontocsv?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.