Skip to content

Commit 8dbda20

Browse files
committed
perf: Remove redundant JSON stringify-parse cycle in HTTP response toJSON method
Eliminates unnecessary performance overhead by returning parseJSON(str) directly instead of converting the already-parsed JavaScript object to a JSON string and then parsing it back. HTTP response data doesn't contain circular references that would require safeJsonStringify processing. Signed-off-by: alvidofaisal <[email protected]>
1 parent 42b08c8 commit 8dbda20

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/core/http/http-request/index.android.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ function onRequestComplete(requestId: number, result: org.nativescript.widgets.A
153153
str = result.responseAsString;
154154
}
155155

156-
// Use safeJsonStringify instead of parseJSON directly
157-
return JSON.parse(safeJsonStringify(parseJSON(str)));
156+
return parseJSON(str);
158157
},
159158
toImage: () => {
160159
ensureImageSource();

0 commit comments

Comments
 (0)