Posted 24 November 2020, 4:20 am EST
Hi
Serializing the excel using the ```
toJSON()
Is there a way to reduce the size of the sterilized json? This is causing performance issues in my application.
Regards
Satendar
Forums Home / Spread / SpreadJS
Posted by: accounts on 24 November 2020, 4:20 am EST
Posted 24 November 2020, 4:20 am EST
Hi
Serializing the excel using the ```
toJSON()
Is there a way to reduce the size of the sterilized json? This is causing performance issues in my application.
Regards
Satendar
Posted 24 November 2020, 8:24 pm EST
Hi Satendar,
We are unable to replicate the issue at our end… Could you please share a sample file on which you are facing this issue? so that we could investigate it further and assist you accordingly.
Regards
Avinash
Posted 26 November 2020, 12:24 am EST
Hi Avinash,
Thanks for your reply.
I was suspecting 2-3x increase in size, but in this case 900kb excel exported to json is 14MB! This is turning out to be a blocker for us to use spreadjs in our application
As requested I have created a demo app. I was going to put it on stackblitz, but realized the spreadjs component does not load as the license is tied to the domain.
I have created a sample angular app for you. In the zip file you will find
“Sample angular project. Look at the HemoComponent for the spreadjs code”
“A sample excel sheet (900kb in size)”
“Serilised json exported from spreadjs for the sample excel sheet(14MB is size)”
Steps to Follow:
“Launch the app”
“Upload the excel provided in the zip file”
“Hit Download JSON on the page”
Regards
Satendar
Posted 26 November 2020, 12:26 am EST
Attaching the file:
Posted 27 November 2020, 4:06 pm EST
Hi Avinash,
Please let me know if you have any findings/ suggestions on this issue?
We already had to temporarily remove spreadjs from our application due to this issue.
Posted 30 November 2020, 5:06 pm EST
Hi,
Sorry for the delayed response. This doesn’t seems like anm expected behavior from the SpreadJS hence we have escalated this issue to our devs for further investigation.
We will update you regarding this as soon as we get any information. The internal ID for this issue will be SJS-6725.
Regards
Avinash
Posted 30 November 2020, 11:36 pm EST
Thanks for escalating this Avihash. As I mentioned currently we are not able to use spreadjs in our application and have disabled it.
We love the capabilities spreadjs brings to our app, hoping to hear from you sooner as that we can offer the features to our customers.
Posted 10 December 2020, 3:44 pm EST
HI,
The Dev team informed us that this is by design. Since the excel file is a zip file JSON files are not there should not be any comparison among both the files. could you please provide what exactly the issue you are having so that we could assist you accordingly.
Regards
Avinash
Posted 30 March 2021, 11:26 pm EST
Hello Avinash!
in our project we are facing the same “issue” which is as you said “working as designed”.
In our case we are creating the excel on the server side (.Net Core 3.1 with GrapeCity.Documents.Excel 3.2.2) and then serialize it to JSON and sending it via HTTP to the Frontend (Angular 10, SpreadJS 13.2.3).
It results in:
System.ArgumentException: The JSON value of length 168634408 is too large and not supported.
at System.Text.Json.ThrowHelper.ThrowArgumentException_ValueTooLarge(Int32 tokenLength)
at System.Text.Json.Utf8JsonWriter.WriteStringValue(ReadOnlySpan`1 value)
at System.Text.Json.Serialization.Converters.JsonConverterString.Write(Utf8JsonWriter writer, String value, JsonSerializerOptions options)
Can you recommend another approach?
Posted 4 April 2021, 8:31 pm EST
Hi Juri,
Regarding the error:
This error is not related to SpreadJS. You could use aspnet:MaxJsonDeserializerMembers and increase the deserialize limits. Please refer to the following StackOverflow discussion and let us know if that helps.
https://stackoverflow.com/questions/10966328/getting-the-json-request-was-too-large-to-be-deserialized
Regarding the other Approach.
There could be several approaches for solving this issue? please refer to the following point and let us know if you face any issues.
You could zip the JSON before sending (at backend using C#) and unzip the JSON after receiving the JSON(at frontEnd using JS)
You could just share the Excel file at the frontend end-use the ExcelIO.open method for loading the excel file at the frontEnd.
Hope This clarifies the issue.
Regards
Avinash