akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.01k stars 807 forks source link

json_dumps() showing 'ld' for integers #602

Closed 313ctr0nz closed 1 year ago

313ctr0nz commented 2 years ago

Hi!

I'm running the latest jansson on an ARM CM4 (Cypress PSOC6) using ModusToolbox 2.4 compiler. I added the jansson submodule and added it to the build.

Both in my own experimentation with integer arrays, and using a jannson example from https://cppsecrets.com/users/113459711411711010711710997114469711310964103109971051084699111109/Creating-and-Reading-JSON-Objects-in-C00-using-Jansson.php

What I expect

{
    "name": "alice",
    "city": "delhi",
    "roll": 50
}

my result

{
    "name": "alice",
    "city": "delhi",
    "roll": ld
}

I've never seen this before with jansson, but last I used it was on a cortex A with native GCC. Any ideas? Floating point seems just fine.

kkarnatak commented 2 years ago

How did you compile for ARM processor? What compiler and flags did you use?

akheron commented 1 year ago

The snprintf impementation of your libc probably doesn't support the %ld or %lld format specifiers. That's pretty much required for jansson to be able to encode json integers.