Serial Communication between Arduino Nano and ESP32 using ArduinoJson

Welcome to the Arduino help forum. Thank you for providing your code nicely formatted.

I did a search on your error:

ESP32 + Arduino +"Stack smashing protect failure!"

Within the results returned, I found this thread suggesting "S"tring could be the issue:

Personally, I would not use JSON library to move between two microcontrollers; just move a struct, more efficient.
How to send and receive struct data packet over serial - Using Arduino / Programming Questions - Arduino Forum