Node.js Quickstart
With just a few lines of code, your node.js application can convert CSV and JSON data to awesome plain-text tables.
Examples
const axios = require('axios');
const stringify = require('csv-stringify')
data = [
["Pokemon","Type","Number"],
["Venusaur","Grass",3],
["Charizard","Fire",6],
["Blastoise","Water",9],
["Pikachu","Electric",25]
]
url = "https://mkconvert.p.rapidapi.com/table?table-tablefmt=github"
config = {
"headers": {
"Content-Type": "text/plain",
"X-RapidAPI-Host": "mkconvert.p.rapidapi.com",
"X-RapidAPI-Key": "<rapid api key>"
}
}
stringify(data, (err, output) => {
axios.post(url, output, config)
.then(function (response) {
console.log(response.data.data);
})
.catch(function (error) {
console.log(error);
})
})
# Output
| Pokemon | Type | Number |
|-----------|----------|----------|
| Venusaur | Grass | 3 |
| Charizard | Fire | 6 |
| Blastoise | Water | 9 |
| Pikachu | Electric | 25 |
const axios = require("axios");
data = [
{
"Pokemon": "Venusaur",
"Type": "Grass",
"Number": 3
},
{
"Pokemon": "Charizard",
"Type": "Fire",
"Number": 6
},
{
"Pokemon": "Blastoise",
"Type": "Water",
"Number": 9
},
{
"Pokemon": "Pikachu",
"Type": "Electric",
"Number": 25
}
]
url = "https://mkconvert.p.rapidapi.com/table?table-tablefmt=github"
config = {
"headers": {
"Content-Type": "application/json",
"X-RapidAPI-Host": "mkconvert.p.rapidapi.com",
"X-RapidAPI-Key": "<rapid api key>"
}
}
axios.post(url, data, config)
.then(function (response) {
console.log(response.data.data);
})
.catch(function (error) {
console.log(error);
});
# Output
| Pokemon | Type | Number |
|-----------|----------|----------|
| Venusaur | Grass | 3 |
| Charizard | Fire | 6 |
| Blastoise | Water | 9 |
| Pikachu | Electric | 25 |
Next Steps
Dive into the API Reference to view all available options.