Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
e-moran opened this issue Apr 30, 2024 · 5 comments
Open
2 tasks done

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

e-moran opened this issue Apr 30, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@e-moran
Copy link

e-moran commented Apr 30, 2024

I have checked the following:

  • I use the newest version of bruno.
  • 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 e-moran added the bug Something isn't working label Apr 30, 2024
@misaelvillaverde
Copy link

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

@e-moran e-moran changed the title JSON String containing a number is sent as a string, not a number JSON String containing a number is sent as a number, not a string May 1, 2024
@shravan20
Copy link

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

@jaakla
Copy link

jaakla commented Jun 6, 2024

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
Copy link
Contributor

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

@Its-treason
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants