You use PlatformIO, and your program works correctly when compiled in “release” mode.
However, when you compile with the “debug” mode, the ESP8266 behaves weirdly or crashes with wdt reset?

This is a known issue due to a stack overflow in the recursive part of deserializeJson().
Indeed, when compiled with the flag -Og (the default when you build in “debug” mode), the stack usage in deserializeJson() is multiplied by five.

To fix this issue, upgrade to ArduinoJson 6.16 or above.

As an alternative, you can also change the debug_build_flags. Instead of the default -Og -g2 -ggdb2, use -O0 -g2 -ggdb2.

; platformio.ini
build_type = debug
debug_build_flags = -O0 -g2 -ggdb2

The flag -O0 disables all optimization; it used to be the recommended flag before GCC 4.8 introduced -Og.

Global warming stripes by Professor Ed Hawkins (University of Reading)