Your inventory lives in a spreadsheet, because spreadsheets are where inventories live. Your mobile app, however, wants JSON: a structured file it can load at startup and turn into product screens. The gap between the two is one conversion, and the conversion itself is quick. What decides whether the app loads the result cleanly is one setting and one behaviour worth knowing first: the header option, and the fact that every value in the output is a string.
This guide converts an inventory file with the free CSV to JSON Converter on Ovatly. It explains what shape the app receives, why quantities and prices arrive as text, and what to check in the output before you hand it over.
Contents
- Quick answer
- What the app actually receives
- Why every value is a string
- How to convert the inventory file, step by step
- Worked example: from spreadsheet rows to app-ready JSON
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Export your inventory sheet as CSV, open the CSV to JSON Converter, paste the text or upload the file, and turn the header option on. Each product row becomes an object whose keys are your column names, in one array of objects. Every value in it is a string, including quantities and prices, so the app must parse the numbers it needs. That is a fair trade: because the converter never guesses types, a SKU of 00123 keeps its leading zeros. The output is an array only; if the app wants a lookup keyed by SKU, it builds that itself from the array.
What the app actually receives
The output shape depends on one checkbox. With the header option on, the first row of the CSV is treated as field names. Every row after it becomes an object, keyed by those names, and the objects arrive in one array, in file order. That is the shape most apps want: iterate the array, read each product's fields by name, and render.
With the header option off, you get an array of arrays instead: every row, including the header row itself, as a plain list of values in column order. For an inventory an app loads, named fields beat column positions. If the spreadsheet ever gains a column, position-based code breaks silently while name-based code keeps working.
One more shape note: the converter outputs arrays only. It never produces a single object keyed by SKU or product name. If your app design assumed a keyed object, the fix belongs in the app: load the array, then index it by SKU once at startup.
Why every value is a string
CSV has no types. A cell holds characters, and the characters 31 could be a quantity, a price, an age or half of a SKU. The converter refuses to guess: every value comes through as a string, exactly as written, never reinterpreted as a number.
This restraint protects the field you can least afford to lose. Inventory SKUs and supplier codes often carry leading zeros, and a converter that parsed numbers would turn the SKU 00123 into 123. The result would still look valid, and match nothing in your warehouse. Strings preserve it character for character.
The cost is real but small, and it lands in the app: where the app needs arithmetic, it parses the quantity and price strings into numbers as it loads. That is a line or two of code, paid once, in exchange for data that arrives unaltered.
How to convert the inventory file, step by step
- Export the inventory sheet as a CSV file from your spreadsheet. Keep the column headers as the first row, and give them the names you want the app to use, because they become the JSON keys.
- Open the CSV to JSON Converter and paste the CSV text or upload the file. The delimiter is auto-detected, so commas, semicolons and tabs are all fine; a tab-separated paste copied straight from the spreadsheet works too.
- Turn the header option on.
- Convert, then read the first object in the output. Its keys should be your column names and its values should match the first product row, as strings.
- Save the JSON for the app, and make sure the app parses quantity and price into numbers where it does arithmetic with them.
Worked example: from spreadsheet rows to app-ready JSON
The mechanism is easiest to see on the converter's own small example. This CSV:
name,age
Ana,31
Ben,28
with the header option on, becomes:
[
{ "name": "Ana", "age": "31" },
{ "name": "Ben", "age": "28" }
]
Note the quotes around 31 and 28. The values are strings, exactly as the CSV held them. Your inventory file follows the identical pattern, with more useful columns:
sku,product,quantity,price
00123,Notebook A5,40,3.50
00456,Gel pen black,120,1.25
It converts to an array of two objects. The first is:
{ "sku": "00123", "product": "Notebook A5", "quantity": "40", "price": "3.50" }
The SKU keeps its leading zeros, the product name reads as expected, and quantity and price are strings the app parses when it needs them as numbers. Same checks apply: count the objects against your spreadsheet rows, and read the first and last one before shipping the file.
Limitations and honest tradeoffs
The output is always an array. There is no option for a keyed object, no nesting, and no way to rename fields during conversion. If the app wants different key names, rename the spreadsheet headers before exporting; that is the cleaner place for it anyway.
Rows that are short get padded with empty strings so every object carries the same keys. That keeps the shape uniform, but it means a product with a missing price arrives with an empty string rather than an absent field. The app has to treat that empty string as missing data, and your spreadsheet cleanup should catch why it was missing.
Fields containing commas follow the standard CSV quoting rules: the value must be quoted in the CSV, and the converter reads quoted fields by those rules. A hand-typed CSV with bare commas inside product names will split those names into two fields, so export from the spreadsheet rather than typing the file out.
Finally, the string behaviour cuts both ways. It protects codes and leading zeros perfectly, but the app team must know numbers are not numbers yet. Say it in the handover note, not just in this file.
Common mistakes
- Leaving the header option off. The output becomes an array of arrays with the header row sitting inside it as data, and the app gets positions instead of names.
- Expecting numbers. Quantity and price arrive as strings. If the app does arithmetic without parsing, it will concatenate or fail in ways that look like data bugs.
- Expecting a SKU-keyed object. The converter outputs an array only. Build the lookup in the app.
- Typing the CSV by hand. A comma inside a product name breaks the row unless it is quoted. Export from the spreadsheet, which quotes correctly.
- Shipping the file without reading it. Count the objects against the spreadsheet rows and read the first and last object. Thirty seconds of checking beats a broken catalogue in the app.
FAQs
Why are my quantities and prices strings in the JSON? CSV is plain text, and the converter never guesses types, so every value stays a string exactly as written. Your app parses the fields it needs as numbers. The payoff: a SKU of 00123 keeps its leading zeros instead of collapsing to 123.
What does the header option do? With the header option on, the first row of the CSV becomes the keys and every following row becomes one object. With it off, the output is an array of arrays, header row included as data. For an inventory file the app loads, you almost always want it on.
Can I paste from a spreadsheet instead of saving a CSV file? Yes. Paste the rows or upload the file. The delimiter is auto-detected (commas, semicolons, tabs), so a tab-separated paste straight from a spreadsheet works as it is.
What happens if a row has fewer cells than the header? Short rows are padded with empty strings, so every object in the output has the same set of keys. Your app should treat an empty string in a field such as price as missing data.
Can the converter output an object keyed by SKU? No. The output is always an array, never a keyed object. If the app needs SKU lookups, build that index in the app by iterating the array once at load.
Conclusion
The conversion itself is five minutes: export, paste, header on, convert, check the first object. The parts worth your attention are the two honest behaviours, strings for every value and an array as the only output shape, because both are deliberate and both protect your data. Once the JSON side is in the app, the YAML side of the data toolbox has its own verification habit, covered in our guide to checking a converted JSON file against the original YAML. For more guides in this series, see our Data and JSON Tools guides.
References
- RFC 4180, the common format and MIME type for CSV files: https://www.rfc-editor.org/rfc/rfc4180
- MDN Web Docs, on JSON and working with objects in JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_objects