1

I want to get CSV data from local file and convert it into JSON object(IOS and android). Is there any plugin available that can convert a CSV file to JSON in react-native

1 Answer 1

2

You should be fine using papaparse.

Install it via npm.

npm install papaparse

Parse a CSV string to json as follows.

import PapaParse from 'papaparse'

options = {} // dummy options
PapaParse.parse(str, options);

The variable str contains the CSV. The return value is a JSON object.

There exists a convenient wrapper around papaparse for react native called react-native-csv, but it doesn’t seem to be updated frequently.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.