undertakerfan
New Member
I have a JSON object that contains about 150 entries of the form \[code\][key] : [sentence]\[/code\] where sentence often contains the same text over and over again. For example:\[code\]var test = { "abc" : "This is the first sentence that is in this JSON object. Hello! Blue." "abd" : "Red. This is the second sentence that is in this JSON object. Hi!" "abe" : "This is the third sentence that is in this JSON object. Hey! Yellow." "abf" : "White. This is the fourte sentence that is in this JSON object. Hola!"}\[/code\]You can see that the string "sentence that is in this JSON object." repeats quite often. Would it be more efficient to replace it with some anchor and then replace the anchor once I get the entry from the object? That is:\[code\]var test = { "abc" : "This is the first #anchor# Hello!" "abd" : "This is the second #anchor# Hi!" "abe" : "This is the third #anchor# Hey!" "abf" : "This is the fourte #anchor# Hola!"}var anchor = "sentence that is in this JSON object."\[/code\]And upon getting the desired value from the JSON, replace the string with the actual text? The sentences don't have a particular pattern but a large number of them contain a repeating string of text. Thanks for your suggestions!