bruno icon indicating copy to clipboard operation
bruno copied to clipboard

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

Open e-moran opened this issue 9 months ago • 2 comments

I have checked the following:

  • [X] I use the newest version of bruno.
  • [X] I've searched existing issues and found nothing related to my issue.

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.

e-moran avatar Apr 30 '24 11:04 e-moran

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

misaelvillaverde avatar Apr 30 '24 17:04 misaelvillaverde

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

shravan20 avatar May 01 '24 14:05 shravan20

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,

jaakla avatar Jun 06 '24 06:06 jaakla

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

jwetzell avatar Jun 21 '24 12:06 jwetzell

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.

Its-treason avatar Jun 21 '24 13:06 Its-treason

This has been fixed as a part of PR https://github.com/usebruno/bruno/pull/2773, and will go out in the v1.27.0 release.

helloanoop avatar Aug 27 '24 09:08 helloanoop