CSV to JSON Keep Nulls
Empty cells in a CSV are ambiguous: do they mean missing data, an explicit empty string, or a default zero? JSON distinguishes null from empty string from zero, so the conversion has to pick a representation for empty cells.
Native JSON tool
CSV to JSON
Uniform null for empties
Schema-consistent output
DB and API friendly
Toggle on or off
- Cost
- Free tier
- Sign-up
- Not required
- Processing
- Tool-specific
- Privacy
- Clearly disclosed
Add this CSV to JSON to your website
Drop the CSV to JSON into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.
- One copy-ready line of HTML
- Responsive — adapts to any container width
- No API credentials are placed in the snippet
Embed code
<iframe
src="https://www.fixtools.io/json/csv-to-json?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="CSV to JSON by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
Choosing null versus empty string
Both null and empty string are valid JSON values that can mean missing. The difference matters when the consumer treats them differently. SQL NULL is a distinct value with three-valued logic; SQL empty string is a string of zero characters that participates in normal string comparisons. JavaScript both null and empty string are falsy in boolean contexts but differ in JSON.stringify output and in equality checks. Picking the right representation for your context avoids subtle bugs where empty cells are interpreted inconsistently.
FixTools default rule is context-sensitive: numeric and boolean columns emit null for empty cells because there is no zero-value representation that means missing, while string columns emit empty string because that is the closer match for textual emptiness. This default works for most use cases but can produce inconsistency across columns. With Keep Nulls enabled, every empty cell becomes null regardless of column type, which is the cleaner choice when consistency matters more than the contextual nuance.
For database loads, Keep Nulls is usually the right choice because columns with NOT NULL constraints are checked against actual null values during INSERT. An empty string slips through a NOT NULL constraint because it is not null, but it may violate a CHECK constraint or business rule that requires non-empty values. By making missing data explicit as null, you can detect schema violations at load time rather than at query time.
For API contracts that specify null for missing fields, Keep Nulls is again the right choice. JSON Schema validation typically distinguishes type string from type null and complains if a field marked null is empty string. Producing null in the converter avoids these validation failures and matches the contract literally. The toggle costs nothing and the consistency is worth the keystroke.
How to use this tool
Toggle Keep Nulls to emit JSON null for every empty cell, regardless of column type.
How It Works
Step-by-step guide to csv to json keep nulls:
- 1
Decide based on consumer schema
Check whether your consumer expects null or empty string for missing data. Database loads usually want null. APIs often specify null. Frontends sometimes prefer empty string for direct rendering.
- 2
Enable Keep Nulls
Toggle the Keep Nulls option in the converter before clicking Convert. The setting applies to every empty cell in the conversion.
- 3
Convert and inspect
Confirm in the preview that empty cells become null. Both numeric and string columns should show null rather than empty string for missing values.
- 4
Validate against schema
If your consumer uses JSON Schema, validate the output. Schema with type [string, null] accepts both, while strict type [string] would reject null.
- 5
Download
Save the JSON. The null representation is unambiguous and matches the consumer expectation.
Real-world examples
Common situations where this approach makes a real difference:
Postgres load with NOT NULL constraints
A data engineer loads CSV into Postgres where some columns have NOT NULL constraints. With Keep Nulls, missing cells are caught at load time as constraint violations rather than slipping through as empty strings.
GraphQL response shape
A backend developer prepares fixture data for GraphQL where nullable fields are explicit. Keep Nulls produces fixtures that match the GraphQL schema directly.
OpenAPI specification compliance
An API team requires that missing values be null per their OpenAPI spec. Keep Nulls ensures the converted JSON validates against the spec.
Data warehouse ingestion
A warehouse ETL job differentiates null from empty string for analytics queries. Keep Nulls produces the cleaner representation that the warehouse expects.
Pro tips
Get better results with these expert suggestions:
Match the consumer expectation
Pick null or empty string based on what your consumer actually checks. Mixing the two in the same dataset is the worst outcome because consumer code has to handle both. Pick one and stick to it.
Document the choice
Add a note to your data documentation specifying that empty cells in the CSV produce null in the JSON. Future maintainers know the convention without re-reading conversion code.
Combine with type inference
Keep Nulls plus type inference produces the cleanest result: typed numeric columns with null for missing, typed boolean columns with null for missing, and string columns with null rather than empty string.
Test the round-trip
Convert CSV to JSON with Keep Nulls, then JSON back to CSV. Null in JSON becomes empty cell in CSV, which restores the original cleanly. Confirm by diffing the two CSV files.
Frequently asked questions
Related guides
More use-case guides for the same tool:
Related tools
Other tools you might find useful:
Ready to get started?
Open CSV to JSON to review its free limits and processing method.
Open CSV to JSON →Free tier · No account needed · Transparent limits