usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
22.47k stars 1.04k forks source link

JSON String containing a number is sent as a number, not a string #2207

Open e-moran opened 3 months ago

e-moran commented 3 months ago

I have checked the following:

Describe the bug

If the body type is set to JSON and a JSON String containing a number is entered then it will be converted to a JSON Number before being sent.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

This screenshot shows the result of hitting an endpoint that reflects the received bytes exactly.

misaelvillaverde commented 3 months ago

Something similar happens to me. If I send any number bigger than 15 digits (including .) it will convert it to a string CleanShot 2024-04-30 at 12 00 46@2x

shravan20 commented 2 months ago

I would like to take a look at this issue. Can I pick it up?

jaakla commented 1 month ago

My case: a) converted from number to string, and rejected by my used server as 'wrong type':

          "lat": 53.07705961249196,
          "lng": -1.1654971750050664,

b) not converted, works as number, all good

         "position": {
          "lat": 51.6552,
          "lng": -0.3471,
jwetzell commented 1 month ago

related to #2438 I believe. The JSON parser that is being used seems less than ideal.

Its-treason commented 1 month ago

related to #2438 I believe. The JSON parser that is being used seems less than ideal.

Yeah, JSONBigint does some weird conversions. I think we should switch to lossless-json. I already used and in my Fork: https://github.com/Its-treason/bruno and it never had such issues.