[GH-ISSUE #1595] JSON long value become incorrect after scripting #1586

Open
opened 2026-03-03 19:52:40 +03:00 by kerem · 11 comments
Owner

Originally created by @BryanSer on GitHub (Apr 10, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1595

Originally assigned to: @NghiaTranUIT on GitHub.

Description

JSON long value become incorrect after scripting
image
image
user_id_str is string type value for user_id. After script, the number value become incorrect.
Expected user_id is equals user_id_str
the only one script is enabled.
image

Steps to Reproduce

  1. Enable Script
  2. Add script

Environment

  • App version: e.g Proxyman 4.5.0(45000)
  • macOS version: e.g macOS Monterey 12.5.1
Originally created by @BryanSer on GitHub (Apr 10, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1595 Originally assigned to: @NghiaTranUIT on GitHub. ## Description JSON long value become incorrect after scripting ![image](https://user-images.githubusercontent.com/26378249/230825457-6d01c029-392e-4d36-ace9-fc3ee1f3dec2.png) ![image](https://user-images.githubusercontent.com/26378249/230825473-852f8b53-b3ef-4dae-98b3-19f832c8b415.png) user_id_str is string type value for user_id. After script, the number value become incorrect. Expected user_id is equals user_id_str the only one script is enabled. ![image](https://user-images.githubusercontent.com/26378249/230825685-002cd5d7-b329-4ae0-a358-836d91d2f798.png) ## Steps to Reproduce 1. Enable Script 2. Add script ## Environment - App version: e.g Proxyman 4.5.0(45000) - macOS version: e.g macOS Monterey 12.5.1
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 10, 2023):

Thanks. This feature is really difficult to fix because it's how Swift and JavascriptCore work. They could not properly handle the big Int or Big Float.

If you don't mind, you can use the Map Local, which allows you modify the Response as you mentioned 👍

<!-- gh-comment-id:1501388396 --> @NghiaTranUIT commented on GitHub (Apr 10, 2023): Thanks. This feature is really difficult to fix because it's how Swift and JavascriptCore work. They could not properly handle the big Int or Big Float. If you don't mind, you can use the Map Local, which allows you modify the Response as you mentioned 👍
Author
Owner

@BryanSer commented on GitHub (Apr 10, 2023):

Okey, but in some case, i need script.
will this feature be fixed in the future

<!-- gh-comment-id:1501596078 --> @BryanSer commented on GitHub (Apr 10, 2023): > Okey, but in some case, i need script. will this feature be fixed in the future
Author
Owner

@BryanSer commented on GitHub (Apr 10, 2023):

Maybe we can try to provide another scripting language to fix this issue?

<!-- gh-comment-id:1501604641 --> @BryanSer commented on GitHub (Apr 10, 2023): Maybe we can try to provide another scripting language to fix this issue?
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 10, 2023):

I will investigate in the next release 👍

<!-- gh-comment-id:1501894774 --> @NghiaTranUIT commented on GitHub (Apr 10, 2023): I will investigate in the next release 👍
Author
Owner

@BryanSer commented on GitHub (May 26, 2023):

Hello, I saw that version 4.8.0 has been released. I was wondering if the issue has been fixed by now.

<!-- gh-comment-id:1564118881 --> @BryanSer commented on GitHub (May 26, 2023): Hello, I saw that version 4.8.0 has been released. I was wondering if the issue has been fixed by now.
Author
Owner

@NghiaTranUIT commented on GitHub (May 29, 2023):

Sorry, it isn't fixed yet : /

<!-- gh-comment-id:1566809938 --> @NghiaTranUIT commented on GitHub (May 29, 2023): Sorry, it isn't fixed yet : /
Author
Owner

@BryanSer commented on GitHub (Jul 18, 2023):

Hello, has this issue been fixed?

<!-- gh-comment-id:1639294623 --> @BryanSer commented on GitHub (Jul 18, 2023): Hello, has this issue been fixed?
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 18, 2023):

Sorry, I could not find any solution because it's from deep inside Apple Framework (JavascriptCore) : /

<!-- gh-comment-id:1639296945 --> @NghiaTranUIT commented on GitHub (Jul 18, 2023): Sorry, I could not find any solution because it's from deep inside Apple Framework (JavascriptCore) : /
Author
Owner

@BryanSer commented on GitHub (Jul 18, 2023):

Sorry, I could not find any solution because it's from deep inside Apple Framework (JavascriptCore) : /

maybe can provide another script language to avoid the issue?
Such as kotlin script, python?

<!-- gh-comment-id:1640066000 --> @BryanSer commented on GitHub (Jul 18, 2023): > Sorry, I could not find any solution because it's from deep inside Apple Framework (JavascriptCore) : / maybe can provide another script language to avoid the issue? Such as kotlin script, python?
Author
Owner

@jefferyfan commented on GitHub (Nov 12, 2025):

I’m also encountering the same issue.
Has this been fixed in the latest version, or is there any update on it?

<!-- gh-comment-id:3520016581 --> @jefferyfan commented on GitHub (Nov 12, 2025): I’m also encountering the same issue. Has this been fixed in the latest version, or is there any update on it?
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 12, 2025):

@jefferyfan it's still an known issue because it's the limitation of the Swift and JavaScriptCore when storing a big number.

To workaround, you can use this code to directly map to your local file. Proxyman won't parse the big number, so it will work

function onResponse(context, url, request, response) {
 
  response.headers["Content-Type"] = "application/json";
  response.bodyFilePath = "~/Desktop/my_response.json";
 
  // Done
  return response;
}

Ref: https://docs.proxyman.com/scripting/snippet-code#map-a-local-file-to-responses-body-like-map-local-tool-proxyman-2.25.0

<!-- gh-comment-id:3520604664 --> @NghiaTranUIT commented on GitHub (Nov 12, 2025): @jefferyfan it's still an known issue because it's the limitation of the Swift and JavaScriptCore when storing a big number. To workaround, you can use this code to directly map to your local file. Proxyman won't parse the big number, so it will work ```js function onResponse(context, url, request, response) { response.headers["Content-Type"] = "application/json"; response.bodyFilePath = "~/Desktop/my_response.json"; // Done return response; } ``` Ref: https://docs.proxyman.com/scripting/snippet-code#map-a-local-file-to-responses-body-like-map-local-tool-proxyman-2.25.0
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1586
No description provided.