JavaScript should use native JSON parse/stringify for *Raw routines
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenSRF |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
Reference:
https:/
Browser Support:
All modern browser support JSON.parse() and JSON.stringify(), which implements JSON handling natively in the browser. Though I have not confirmed this, I would assume that native parsing (likely implemented within the lower-level language of the browser) is faster and requires fewer resources than our JavaScript JSON parsing and stringifying routines. Using the native parser would also let us reduce (by a small amount) our JS code footprint.
Patch forthcoming to use JSON.parse and JSON.stringify as replacements for JSON2jsRaw and js2JSONRaw in JSON_v1.js. I'll leave the *Raw functions in place for now, though, until we confirm no code is accessing those directly.
===
Do we need to support IE7? If so, we could alternatively check for the presence of window.JSON and only use it when it's available...
===
Note, we still need JSON_v1.js for encoding and decoding field-mapped objects. That section of the code will remain the same.
Changed in opensrf: | |
status: | Fix Committed → Fix Released |
Actually, just confirmed that no OpenSRF or Evergreen code is directly access either of the *Raw functions, apart from their unit tests. If no objections, I'll remove those too...