Countdown to someone writing a plugin that transforms all serializble object literals to JSON.parse
-
-
-
There should be a size threshold of some sort. It only really makes sense for “large” objects, like Redux stores.
- 2 more replies
New conversation -
-
-
Escape them with a backslash ie JSON.parse('{"thing": "a single quote \' was here"}')
- 4 more replies
New conversation -
-
-
Does this hold x-browser?
-
Parsing JSON is inherently less complex compared to JavaScript, so you can assume this holds true in all JavaScript engines.
- 6 more replies
New conversation -
-
-
Is this something Closure Compiler can optimize? Ideally our source code can stay consistent and maintainable while compilers keep up to date with the best practices for squeezing the performance juice out of JS.
-
+1. This is definitely not something developers should be doing manually. Bundlers and other tooling that produces JS can add heuristics and make the optimal choice based on the object’s size.
- 2 more replies
New conversation -
-
-
Looks like a nightmare to debug or modify.
-
You wouldn’t write code like this by hand.
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
Perf tip: if your web app ships large JSON-like configuration as JavaScript object literals, consider using JSON.parse instead. It’s much faster, especially for cold loads!