Relationship between toJSON and sjs file format

Posted by: peter on 27 October 2025, 2:25 am EST

  • Posted 27 October 2025, 2:25 am EST

    Hi,

    I’m confused about the various SpreadJS serialization formats.

    • toJSON() gives some json that could be saved. Is it lossless?
    • what is the relationship between the SJS file format and JSON?
    • if I just want to transmit the spreadsheet over the wire, should I use JSON?
    • what is the performance of fromJSON vs open(sjs_file) ?
  • Posted 27 October 2025, 2:48 am EST

    Also, I’d like to know the save/open performance comparing excel vs json bytes vs sjs

  • Posted 27 October 2025, 6:17 am EST - Updated 29 October 2025, 1:32 am EST

    Hi Peter,

    Please refer to the answers to your questions below:

    1. Is toJSON() lossless?: No, toJSON() is not fully lossless. It serializes the complete workbook state, including styles, formulas, and data bindings. You can control what gets serialized using the serialization options. However, it does not support macro serialization and some other unsupported features.
    2. SJS vs JSON: SJS (introduced in v16) is an optimized, compressed format - essentially a ZIP archive containing multiple smaller JSON files. SSJSON/JSON is a single large JSON object. SJS provides smaller and gzip-compressed file sizes and faster load/save performance compared to JSON format.
    3. For network transmission: Both SJS and JSON can work, but SJS is recommended for production due to a smaller payload size and better performance. JSON is simpler for small files or database storage. However, we recommend working with the SJS format.
    4. Performance comparison: SJS (being native to SpreadJS and developed specifically for SpreadJS) significantly outperforms both JSON and Excel formats.

    You can further refer to the attached references. The Reference 1 demonstrates the performance comparison of SJS, JSON, and Excel files.

    Best Regards,

    Chirag Gupta

    References:

    1. New JavaScript Spreadsheet File Formats in SpreadJS v16: https://developer.mescius.com/blogs/new-javascript-spreadsheet-file-formats-in-spreadjs-v-16
    2. toJSON: https://developer.mescius.com/spreadjs/api/classes/GC.Spread.Sheets.Workbook#tojson
    3. Serialization options: https://developer.mescius.com/spreadjs/api/interfaces/GC.Spread.Sheets.ISerializationOption
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels