Skip to converter

ODS to JSON — an application expecting objects meeting a spreadsheet supplying a grid

The app wants objects; the spreadsheet has a grid. The conversion takes the first row of the OpenDocument sheet as keys and writes one object per following row. The interesting part is not the mapping but what the receiving code has to tolerate afterwards: strings where you expected numbers, null where you expected a value, and extra objects from sheets nobody asked for.

Cell formatting, colours, column widths and merged ranges are dropped; only stored values survive.

Drop files here or ODS, up to 12 MB
    Add a file to start.

    Processed on your device. Files aren’t sent anywhere.

    No sign-up. Nothing to install.

    Grid to objects

    The reader opens the compressed OpenDocument container, reads the sheet as displayed text, and maps columns onto property names.

    • The first row supplies the keys.
    • A blank header cell gets a generated name such as column_3.
    • Repeated header names get numeric suffixes.
    • Rows that are entirely empty produce no object.

    What the receiving code must tolerate

    Cells are read as the text the sheet displays, so nothing arrives typed. Validate before trusting.

    CellJSON valueTolerate
    Fee of 40"40"a string, not a number
    Empty fee cellnullhandle explicitly, not as zero
    Date shown as 12 Mar 2003"12 Mar 2003"parse or keep as text
    Text with an accentthe same charactersUTF-8 output

    Extra sheets appended into one array

    With All sheets every sheet in the document is converted and appended into one array. Nothing marks which sheet an object came from, so a Notes sheet contributes objects with keys your schema never declared. Use First sheet unless you genuinely want every sheet.

    Questions

    Why is a fee a string?
    Cells are read as the formatted text stored in the sheet, and the converter does not decide which columns are numeric. Parse the strings your schema declares as numbers.
    What does a blank cell become?
    null. An empty string would look like a value and zero would invent one, so the app must handle null explicitly.
    Are OpenDocument formulas evaluated?
    No. The value stored in the file is copied and the formula text is dropped.
    Do other sheets appear in the array?
    Only with All sheets, which appends every sheet into one array without recording the sheet each object came from.

    Dates as displayed text

    A date cell leaves as the characters shown on screen, not as an ISO timestamp and not as a serial number. The document's own formatting decides the shape, so two files can produce two different date strings for the same day.

    Validating the JSON before shipping it

    Treat the output as an untrusted payload.

    1. Convert the .ods file and download the JSON.
    2. Parse it and list the keys you actually received.
    3. Assert the types your schema expects and coerce where needed.
    4. Count objects against the sheet rows.
    5. Decide whether extra sheets were wanted before you ship.

    Share this converter

    More sharing options