Socket
Book a DemoInstallSign in
Socket

json_csv_converter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json_csv_converter

0.2.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

JSON CSV Converter

This gem is built to help at the migration between existing JSON files into the mappings of existing CSV tables and vice versa. To map the keys you provide a YAML file.

Status

Build Status Dependency Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'json_csv_converter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install json_csv_converter

Usage

To convert the data of an existing JSON file into an existing CSV table just run JSONCSVConverter::json_to_csv with the JSON path, the CSV path and the YAML mapping file path as arguments. This method returns a CSV::Table.

The gem also provides an executable named json_csv_converter. It currently only supports conversion from JSON to CSV. If you run

$ json_csv_converter <i>path_to_json</i> <i>path_to_csv</i> <i>path_to_yaml_mapping</i>

you get the completely converted CSV table as String for further processing.

Example:

# create an instance to work with
converter = JSONCSVConverter::Converter.new(json_path,csv_path,mapping_path)

# map each JSON Object to a CSV row
converter.json_to_csv

# get the CSV table
csv_table = converter.csv_table

# get the JSON instance
json = converter.json

# Or simply run the toplevel method
csv_table = JSONCSVConverter.json_to_csv(json_path,csv_path,mapping_path)

FAQs

Package last updated on 23 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.