Code Monkey home page Code Monkey logo

json-to-csv-export's Introduction

⌗ json-to-csv-export

A function to easily generate csv downloads of your json data. ✨

npm package version  npm downloads  code style: prettier

Live Demo

https://json-to-csv-export.coston.io

Features

  • Create a csv/json download from data
  • Convert json/csv data
  • Lightweight
  • Easy to use
  • optional filename

Install

Install with npm:

npm i json-to-csv-export

Or load from a CDN:

<script src="https://cdn.jsdelivr.net/npm/json-to-csv-export"></script>

Example Usage

import csvDownload, { jsonDownload, jsonToCsv, csvToJson } from 'json-to-csv-export'

...

  <button onClick={() => csvDownload(jsonData)}>
    Download CSV Data
  </button>
...

  <code>
    {jsonToCsv(jsonData).data}
  </code>

...
  <button onClick={() => jsonDownload(csvData)}>
    Download JSON Data
  </button>

...

  <code>
    {csvToJson(csvData).data}
  </code>

Download Arguments

# Argument Type Requirement Default Description
1 data object required null string or object
2 filename string optional "export.[csv|json]" The complete filename
3 delimiter string optional "," field separator

Converter Arguments

# Argument Type Requirement Default Description
1 data object required null string or object
2 delimiter string optional "," field separator

Callable Functions

csvDownload()

Singular function to convert and download JSON to CSV data. This is shown in an example above.

jsonDownload()

Singular function to convert and download CSV to JSON data. This is shown in an example above.

csvToJson()

Convert CSV data into JSON data.

Returns
    { data:string, error:string }
  

jsonToCsv()

Convert JSON data into CSV data.

Returns
    { data:string, error:string }
  

Contributing

Please help provide good data faster! Submit any issues and/or make a pull request!

json-to-csv-export's People

Contributors

bvdalling avatar coston avatar dependabot[bot] avatar isker avatar sabril avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.