javascript - JSON object repeated string efficiency -
I have a JSON object that contains approximately 150 entries of the form You can see the string "Sentence that is in this JSON object." It often repeats whether it will be more efficient to replace it with some anchors and then should I replace an anchor when I get an entry from the object? That is: And when you get the desired value from JSON, replace the string with the actual text? Sentences do not have a specific pattern, but a large number of them have a repeated string of text. Thanks for your suggestions! If your Jasonan download has been jipped (which is a lot more likely) then you probably won To save more bandwidth, if any, Gzip compression is very good in removing duplicate strings. To find out, enter your JSON in a file, any since then. Use any jeep feature to create a GJ file. Do the same with your second version of JSON and then compare the size of two .gz files. You may be surprised that there is a difference in it. If you do not have any jizip utility then get it. On the one hand bandwidth, you can save memory in the browser by adding stars. Whether it is worth it or not depends on what we are talking about. [key]: [sentence] Where the sentence often contains the same text repeatedly, for example:
var test = {"abc": "This is the first sentence that is in this JSON object. . " "Abd": "Red, this is the second sentence that is in this JSON object. "AB": "This is the third sentence that is in this JSON object. Hey! Yellow." "ABF": "White, this is the fourth sentence that is in this JSON object. }
var test = {"abc": "This is the first # anchor # hello!" "Abd": "This is the second # anchor # Hi!" "AB": "This is the third # anchor # O!" "ABF": "This is the fourteen # anchor #hole!" } Var anchor = "sentence which is in this JSON object."
Comments
Post a Comment