How to use jsonexport - 3 common examples

To help you get started, we’ve selected a few jsonexport 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 marmelab / react-admin / examples / simple / src / comments / CommentList.js View on Github external
const data = records.map(record => {
            const { author, ...recordForExport } = record; // omit author
            recordForExport.author_name = author.name;
            recordForExport.post_title = posts[record.post_id].title;
            return recordForExport;
        });
        const headers = [
            'id',
            'author_name',
            'post_id',
            'post_title',
            'created_at',
            'body',
        ];

        jsonExport(data, { headers }, (error, csv) => {
            if (error) {
                console.error(error);
            }
            downloadCSV(csv, 'comments');
        });
    });
github marmelab / react-admin / packages / ra-ui-materialui / src / button / ExportButton.tsx View on Github external
.then(({ data }) =>
                    exporter
                        ? exporter(
                              data,
                              fetchRelatedRecords(dataProvider),
                              dataProvider
                          )
                        : jsonExport(data, (err, csv) =>
                              downloadCSV(csv, resource)
                          )
                )
github marmelab / react-admin / examples / simple / src / posts / PostList.js View on Github external
const exporter = posts => {
    const data = posts.map(post => ({
        ...post,
        backlinks: lodashGet(post, 'backlinks', []).map(
            backlink => backlink.url
        ),
    }));
    jsonExport(data, (err, csv) => downloadCSV(csv, 'posts'));
};

jsonexport

Makes easy to convert JSON to CSV

Apache-2.0
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis

Popular jsonexport functions