Skip to content

horizon7006/datafileconverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎨 JSON/YAML/CSV/XML Converter

🚀 What It Does

  • 🔄 Converts JSON ↔ YAML ↔ CSV ↔ XML
  • 📂 Supports files with arrays of objects or arrays of arrays (csv-friendly)
  • 🎨 Pretty prints JSON & YAML for readability
  • 🧩 Uses nokogiri for robust XML parsing & generation

⚙️ Requirements

  • Ruby 3.x+ installed
  • nokogiri gem (install with gem install nokogiri)

🛠️ How to Use

ruby converter.rb --from FORMAT --to FORMAT input_file output_file

FORMAT: json | yaml | csv | xml

input_file: your source file path

output_file: destination file path

Examples

ruby converter.rb --from json --to csv data.json data.csv
ruby converter.rb --from csv --to yaml data.csv data.yml
ruby converter.rb --from xml --to json data.xml data.json

Tips & Notes

XML expects a root with multiple <item> children containing data fields

CSV with headers → array of hashes; without headers → array of arrays supported

If you see errors about .keys on Array, check your input file format — might be nested arrays instead of hashes

Script aims to handle common cases, but weird formats might cause trouble

About

a converter that converts your data files ig

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors