How to use the json2csv.Transform function in json2csv

To help you get started, we’ve selected a few json2csv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / json2csv / json2csv-tests.ts View on Github external
num?: number;
    obj?: object;
}

/**************
 * Public API *
 **************/
parse({});
parse([]);
parse({}, {});

new Parser();
const parser: Parser = new Parser({});
s = parser.parse({ str: '', num: 1, obj: {} });
parser.parse([]);
const transform: Transform = new Transform({ quote: '' });
const nodeTransform: NodeTransform = transform;

// Tests using examples from Readme
interface Car {
    car: string;
    price: number;
}

const opts: json2csv.Options = {
    fields: [
        // Supports pathname -> pathvalue
        'simplepath', // equivalent to {value:'simplepath'}
        'path.to.value', // also equivalent to {value:'path.to.value'}

        // Supports label -> simple path
        {

json2csv

Convert JSON to CSV

MIT
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis