I have a very large object in JavaScript (about 10 MB).
And when I convert it to a string, it takes a lot of time, so I send it to the backend and parse it for an object (actually nested objects with arrays), and this also takes a lot of time, but this is not our problem in this matter.
This problem:
How can I do it JSON.stringifyfaster, any ideas or alternatives, I need a javaScript solution, libraries that I can use, or ideas here.
What i tried
I am a lot JSON.stringifyand there seems to be no better performance than JSON.stringifyor my skills JSON.stringify!
Result
I accept any offer that can solve my long-term savings (sending to the server) in the request (I know its big request).
Sample problem code (details about the problem)
Request URL:http://localhost:8081/systemName/controllerA/update.html;jsessionid=FB3848B6C0F4AD9873EA12DBE61E6008
Request Method:POST
Status Code:200 OK
I send POST to the backend, and then to JAVA
request.getParameter ("BigPostParameter")
and I read it to convert to an object using
public boolean fromJSON(String string) {
if (string != null && !string.isEmpty()) {
ObjectMapper json = new ObjectMapper();
DateFormat dateFormat = new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS_SSS_Z);
dateFormat.setTimeZone(TimeZone.getDefault());
json.setDateFormat(dateFormat);
json.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
WebObject object;
try {
object = json.readValue(string, this.getClass());
} catch (IOException ex) {
Logger.getLogger(JSON_ERROR).log(Level.SEVERE, "JSON Error: {0}", ex.getMessage());
return false;
}
return this.setThis(object);
}
return false;
}
Like this
BigObject someObj = new BigObject();
someObj.fromJSON(request.getParameter("BigPostParameter"))
PS : FYI this line is object = json.readValue(string, this.getClass());also very, very, very slow.
Summarize again
Problem in publication time (stringify) JavaScript bottle nickname.
Another problem when parsing a row into an object (using Jackson), and basically I have the contents of the svg tags in that object as a style column, and the other columns are strings, mostly int