Code Monkey home page Code Monkey logo

json2csv's Introduction

json2csv

npm version Node.js CI Coverage Status license

Fast and highly configurable JSON to CSV converter.

Features

  • Fast and lightweight
  • Support for standard JSON as well as NDJSON
  • Scalable to infinitely large datasets (using stream processing)
  • Advanced data selection (automatic field discovery, underscore-like selectors, custom data getters, default values for missing fields, ...)
  • Support for custom input data transformation
  • Support for custom csv cell formatting.
  • Highly customizable (supportting custom quotation marks, delimiters, eol values, etc.)
  • Automatic escaping (preserving new lines, quotes, etc.)
  • Optional headers
  • Unicode encoding support
  • Pretty printing in table format to stdout

json2csv ecosystem

There are multiple flavours of json2csv:

  • The Plainjs package includes:
    • Parser: Pure Javascript synchronous parser. High-performant and runs both node.js and the browser. It´s the fastes but loads both the JSON and the resulting CSV in memory, and block the event loop while processing. Not recommended unless the JSON data is small.
    • Stream Parser: Pure Javascript stream parser. High-performant and runs both node.js and the browser. It keeps a consistent memory footprint and doesn't block the event loop. It's the base of all other parsers. Recommended to build your own parser.
  • The Node packages includes:
    • Node Transform: Wraps the Stream Parser in a Node.js Transform Stream. Recommended for Node.js users using stream.
    • Node Async Parser: Wraps the Node Transform to offer a friendly promise-based API similar to the synchronous Parser. Recommended for Node.js users that want a higher abstraction level.
  • The WHATWG package includes:
    • WHATWG Transform Stream: Wraps the Stream Parser in a WHATWG Transform Stream. Recommended for browser users using web streams.
    • WHATWG Async Parser: Wraps the WHATWG Transform Stream to offer a friendly promise-based API similar to the synchronous Parser. Recommended for browser users that want a higher abstraction level.
  • The CLI package includes:
    • CLI: Makes the node.js interfaces accesible through the command line. Recommended from CLI (sh/bash/zsh/...) users and CLI scripts.

And a couple of libraries that enable additional configurations:

  • The Transforms package includes the built-in transforms for json2csv (unwind and flatten) allowing the using to transform data before is parsed (See docs).
  • The Formatters package includes the built-in formatters for json2csv (one for each data type, an excel-specific one, etc.). Formatters convert JSON data types into CSV-compatible strings (See docs).

Documentation

See https://juanjodiaz.github.io/json2csv.

License

See LICENSE.md.

json2csv's People

Contributors

ahaurw01 avatar amilajack avatar arvind avatar benwiley4000 avatar daniel-zahariev avatar dbuentello avatar dependabot[bot] avatar eduardomourar avatar evanshortiss avatar expatiating avatar fahrenq avatar glutentag avatar grishenk0 avatar jarib avatar johnpwrs avatar juanjodiaz avatar knownasilya avatar lipp avatar mrdockal avatar pfedan avatar radiodario avatar risseraka avatar shinecita avatar songpr avatar sospedra avatar stephen-dahl avatar thibauts avatar xdissent avatar zemirco avatar zoltantarcsay 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.