normally I parse a json string to json object instead of manipulating the json string directly. for example, a json string like
{"number": "1234567"}
if I have to add 000 at the end
...
{...,"number" : "1234567000",...}
....
I will use jackson either parse it as Json Object or POJO
I understand readability perspective parsing to Json object or POJO is much better, but I'm curious about the performance. In this case, if I manipulate the json string directly, I have to use regex to extract the number attribute, and add 000 at the end, which is much more expensive than parsing to Json Object if having lots of data? because string object basically creates a new string object?
EDIT: Based on @Itai Steinherz's link I also make a benchmark in JS, and it shows json parse is better https://jsbench.me/93jr1w6k5b/1