[GH-ISSUE #1782] JSON float round #1776

Closed
opened 2026-03-03 19:54:18 +03:00 by kerem · 13 comments
Owner

Originally created by @yaroslavyaroslav on GitHub (Sep 26, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1782

Originally assigned to: @NghiaTranUIT on GitHub.

Description

Proxyman rounds float values on JSON to 2 numbers in a fraction part. It's kinda confusing, thus it's unexpected that values of a response/request would be modified instead of just being formatted.

Steps to Reproduce

{"destLocationGroupId":"UUID","sourceLocationGroupId":"UUID","amount":99999.00999999999,"serviceId":"UUID","orderDirection":"DirectionType"}
  1. Send the json above to any given server

Current Behavior

In body tab amount field would be shown as 99999.01

Expected Behavior

To show in body tab exact number as it's stored within raw data.

Environment

  • App version: e.g Proxyman 4.8.0 (48000)
  • macOS version: e.g macOS Sonoma 14.0
Originally created by @yaroslavyaroslav on GitHub (Sep 26, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1782 Originally assigned to: @NghiaTranUIT on GitHub. ## Description Proxyman rounds float values on JSON to 2 numbers in a fraction part. It's kinda confusing, thus it's unexpected that values of a response/request would be modified instead of just being formatted. ## Steps to Reproduce ```json {"destLocationGroupId":"UUID","sourceLocationGroupId":"UUID","amount":99999.00999999999,"serviceId":"UUID","orderDirection":"DirectionType"} ``` 1. Send the json above to any given server ## Current Behavior In body tab `amount` field would be shown as `99999.01` ## Expected Behavior To show in body tab exact number as it's stored within raw data. ## Environment - App version: e.g Proxyman 4.8.0 (48000) - macOS version: e.g macOS Sonoma 14.0
kerem 2026-03-03 19:54:18 +03:00
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 26, 2023):

Do you use Scripting or other tools that modify the value ? By default, Proxyman only proxies the data without modifying any actual data.

<!-- gh-comment-id:1735282547 --> @NghiaTranUIT commented on GitHub (Sep 26, 2023): Do you use Scripting or other tools that modify the value ? By default, Proxyman only proxies the data without modifying any actual data.
Author
Owner

@yaroslavyaroslav commented on GitHub (Sep 26, 2023):

Nope, it's the actual case. I mean the very same response presented in raw tab in its full size as 99999.009999999, but in body size it's not and it's rounded to 2 numbers in a fraction part.

Ps: at first I was meant to write this issue as a question, but I've checked raw tab right before publication, and saw that there's unmodified value presented.

<!-- gh-comment-id:1735456401 --> @yaroslavyaroslav commented on GitHub (Sep 26, 2023): Nope, it's the actual case. I mean the very same response presented in `raw` tab in its full size as `99999.009999999`, but in body size it's not and it's rounded to 2 numbers in a fraction part. Ps: at first I was meant to write this issue as a question, but I've checked raw tab right before publication, and saw that there's unmodified value presented.
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 26, 2023):

Just wondering: Does this issue affect your actual Request/Response on your server-side ? Or just a display issue on the Body Tab 🤔

<!-- gh-comment-id:1735460008 --> @NghiaTranUIT commented on GitHub (Sep 26, 2023): Just wondering: Does this issue affect your actual Request/Response on your server-side ? Or just a display issue on the Body Tab 🤔
Author
Owner

@yaroslavyaroslav commented on GitHub (Sep 26, 2023):

Does this issue affect your actual Request/Response on your server-side ?

It affects, that's how I faced it - I've got a server error that the fractional part are way too long in my request, and that I was struggling to understand why two decimal after a point is too much for it.

<!-- gh-comment-id:1735547667 --> @yaroslavyaroslav commented on GitHub (Sep 26, 2023): > Does this issue affect your actual Request/Response on your server-side ? It affects, that's how I faced it - I've got a server error that the fractional part are way too long in my request, and that I was struggling to understand why two decimal after a point is too much for it.
Author
Owner

@invisible-debug commented on GitHub (Jun 27, 2024):

Also relevant for me. The request is sent correctly to the backend. But the Proxyman does not display correctly. Because of this, it is impossible to debug traffic. It creates a false impression that the bug is on the backend.
Charles displays this correctly

<!-- gh-comment-id:2194285805 --> @invisible-debug commented on GitHub (Jun 27, 2024): Also relevant for me. The request is sent correctly to the backend. But the Proxyman does not display correctly. Because of this, it is impossible to debug traffic. It creates a false impression that the bug is on the backend. Charles displays this correctly
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 27, 2024):

May I ask: @invisible-debug can you see the bug in the Raw Tab?

and do you use any debugging tool?


From what I know, the body and Raw Tab always displays the raw data, except using breakpoint, Map local, or Scripting -> It might change the floating number.

<!-- gh-comment-id:2194287624 --> @NghiaTranUIT commented on GitHub (Jun 27, 2024): May I ask: @invisible-debug can you see the bug in the Raw Tab? and do you use any debugging tool? -------- From what I know, the body and Raw Tab always displays the raw data, except using breakpoint, Map local, or Scripting -> It might change the floating number.
Author
Owner

@invisible-debug commented on GitHub (Jun 27, 2024):

Oh. Raw tab displays correctly, my friend @NghiaTranUIT . Error is displays only on the Body tab
I don't use any debugging tool. Using Postman + Proxyman (5.0.0). And request not edited. This can be seen in the screenshot. There is no check mark in the Edited column.
I attach a screenshot with the original request in Postman and incorrectly displayed in Proxyman
bug_floating_point

Same thing in Raw tab:
bug_floating_point_raw

<!-- gh-comment-id:2194304845 --> @invisible-debug commented on GitHub (Jun 27, 2024): Oh. Raw tab displays correctly, my friend @NghiaTranUIT . Error is displays only on the Body tab I don't use any debugging tool. Using Postman + Proxyman (5.0.0). And request not edited. This can be seen in the screenshot. There is no check mark in the Edited column. I attach a screenshot with the original request in Postman and incorrectly displayed in Proxyman <img width="2419" alt="bug_floating_point" src="https://github.com/ProxymanApp/Proxyman/assets/174007516/141031d6-13d0-41c4-938b-3317a578003a"> Same thing in Raw tab: <img width="757" alt="bug_floating_point_raw" src="https://github.com/ProxymanApp/Proxyman/assets/174007516/e69a19df-f9fe-4207-b5f2-0a3ca0264422">
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 27, 2024):

thanks @invisible-debug I'm able to reproduce this bug. Let me fix it and send a hotfix asap 👍

<!-- gh-comment-id:2194488038 --> @NghiaTranUIT commented on GitHub (Jun 27, 2024): thanks @invisible-debug I'm able to reproduce this bug. Let me fix it and send a hotfix asap 👍
Author
Owner

@invisible-debug commented on GitHub (Jun 27, 2024):

@NghiaTranUIT We have some bureaucratic problems with paying for the license. Will I not be able to get this fix if my subscription expires?

<!-- gh-comment-id:2194496280 --> @invisible-debug commented on GitHub (Jun 27, 2024): @NghiaTranUIT We have some bureaucratic problems with paying for the license. Will I not be able to get this fix if my subscription expires?
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 27, 2024):

Preliminary investigation shows that it's because our JSON Lib (nlohmann/json) doesn't support big numbers by default. I'm going to find a new solution to fix it

<!-- gh-comment-id:2194566355 --> @NghiaTranUIT commented on GitHub (Jun 27, 2024): Preliminary investigation shows that it's because our JSON Lib (nlohmann/json) doesn't support big numbers by default. I'm going to find a new solution to fix it
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 28, 2024):

@invisible-debug let's try this Beta build: https://download.proxyman.io/beta/Proxyman_5.5.0_Try_to_fix_JSON_big_number.dmg

  • Treat all big numbers as a raw value (Not parsing) -> Fix the big float number issue 👍
  • I will write some Unit Tests to make sure it doesn't break other things
Screenshot 2024-06-28 at 09 57 49
<!-- gh-comment-id:2196016442 --> @NghiaTranUIT commented on GitHub (Jun 28, 2024): @invisible-debug let's try this Beta build: https://download.proxyman.io/beta/Proxyman_5.5.0_Try_to_fix_JSON_big_number.dmg - Treat all big numbers as a raw value (Not parsing) -> Fix the big float number issue 👍 - I will write some Unit Tests to make sure it doesn't break other things <img width="710" alt="Screenshot 2024-06-28 at 09 57 49" src="https://github.com/ProxymanApp/Proxyman/assets/5878421/cb9e7d95-4e2d-47d7-889a-a7db29e3b055">
Author
Owner

@invisible-debug commented on GitHub (Jun 28, 2024):

Yes, I checked it out. This really solves the problem. Thanks!
fixed

<!-- gh-comment-id:2196378137 --> @invisible-debug commented on GitHub (Jun 28, 2024): Yes, I checked it out. This really solves the problem. Thanks! <img width="548" alt="fixed" src="https://github.com/ProxymanApp/Proxyman/assets/174007516/efa9edc8-a295-4441-b694-8f70224607fb">
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 28, 2024):

Awesome, I will write some Unit Tests and release it in the next update 👍

<!-- gh-comment-id:2196384538 --> @NghiaTranUIT commented on GitHub (Jun 28, 2024): Awesome, I will write some Unit Tests and release it in the next update 👍
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#1776
No description provided.