تخطي إلى المحتوى الرئيسي
FreeOnlineTools Go
العربية
how-to

كيفية تحويل CSV إلى JSON خطوة بخطوة

By FreeOnlineTools Team · Updated 2026-09-02

Quick Answer

اقرأ ترويسة CSV كمفاتيح، ثم حوّل كل صف إلى كائن بقيم الخلايا. استخدم محول CSV JSON المجاني للتحويل التلقائي — يدعم الترويسات المخصصة والبنى المتداخلة، ويعمل في متصفحك.

Introduction

CSV إلى JSON يحول البيانات الجدولية إلى كائنات JavaScript. الصف الأول عادة ما يكون الترويسة (أسماء الأعمدة)، وكل صف لاحق يصبح كائناً حيث المفاتيح هي أسماء الأعمدة والقيم هي قيم الخلايا. التعامل مع علامات الاقتباس والفواصل المضمنة مهم.

Step by Step

  1. Open the CSV to JSON Converter

    Go to the CSV to JSON Converter tool page. The tool accepts any CSV text as input, including values with commas inside quotes.

  2. Paste your CSV data

    Paste your CSV into the input textarea. A typical CSV has one row per line, with values separated by commas. The first row is often a header row containing column names.

  3. Configure header handling

    If your first row contains column names (headers), enable the 'First row is header' option. The tool will use these names as JSON keys. If disabled, each row becomes a JSON array of values.

  4. Set the delimiter (if needed)

    Most CSV files use commas, but some use semicolons, tabs, or pipes. If your file uses a different delimiter, set it in the options. The tool handles quoted values containing the delimiter correctly.

  5. Convert and copy the JSON

    Click Convert. The tool parses the CSV and outputs JSON. With headers, each row becomes an object like {"name":"Alice","age":"30"}. Copy the JSON to your clipboard for use in your application.

Examples

CSV with headers to JSON objects

Input: name,age,city Alice,30,NYC Bob,25,LA

Output: [ {"name":"Alice","age":"30","city":"NYC"}, {"name":"Bob","age":"25","city":"LA"} ]

CSV with quoted values containing commas

Input: name,note Alice,"Hello, world" Bob,"foo, bar"

Output: [ {"name":"Alice","note":"Hello, world"}, {"name":"Bob","note":"foo, bar"} ]

CSV without headers to JSON arrays

Input: Alice,30,NYC Bob,25,LA

Output: [ ["Alice","30","NYC"], ["Bob","25","LA"] ]

Common Problems

  • All CSV values are strings in JSON —numbers like "30" stay as strings. Convert to numbers in your application with Number() or parseInt().
  • Quoted values with embedded commas —a proper CSV parser handles quotes correctly; naive splitting on commas breaks on values like "Hello, world".
  • Inconsistent row lengths —some rows may have fewer or more columns than the header. The tool pads missing values with null or truncates extra values.
  • Encoding issues —CSV files from Excel may use BOM or different encodings. Save as UTF-8 before pasting.

Tips

  • If your CSV has headers, enable the header option to get JSON objects with named keys —much more useful than arrays.
  • Convert numeric strings to numbers in your application after conversion, since CSV has no type information.
  • For large CSV files (10MB+), use a streaming parser instead of loading the entire file into memory.
  • Use our CSV to JSON Converter for instant, private conversion —no data leaves your browser.

Related Tools

Related Guides

References