lib: json: escape strings in-place
lib: json: escape strings in-place

Currently, json_escape() allocates a temporary buffer on the stack
that's the size of the string being escaped.

Stack space is precious and longer JSON strings can run into the
hundreds of bytes, so re-implement this routine to escape in place.

Signed-off-by: Marti Bolivar <9d90ac4c7bf6a305f6bfd81a23c7859bc883380e@linaro.org>

kraj/zephyr,rsalveti/zephyr,zephyriot/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,Vudentz/zephyr,ldts/zephyr,ldts/zephyr,Vudentz/zephyr,ldts/zephyr,holtmann/zephyr,Vudentz/zephyr,explora26/zephyr,aceofall/zephyr-iotos,ldts/zephyr,fbsder/zephyr,explora26/zephyr,nashif/zephyr,mbolivar/zephyr,aceofall/zephyr-iotos,zephyrproject-rtos/zephyr,bigdinotech/zephyr,zephyriot/zephyr,rsalveti/zephyr,finikorg/zephyr,rsalveti/zephyr,GiulianoFranchetto/zephyr,holtmann/zephyr,Vudentz/zephyr,sharronliu/zephyr,finikorg/zephyr,punitvara/zephyr,pklazy/zephyr,bigdinotech/zephyr,punitvara/zephyr,ldts/zephyr,explora26/zephyr,bigdinotech/zephyr,bigdinotech/zephyr,erwango/zephyr,galak/zephyr,sharronliu/zephyr,galak/zephyr,runchip/zephyr-cc3220,fractalclone/zephyr-riscv,finikorg/zephyr,fractalclone/zephyr-riscv,mbolivar/zephyr,zephyriot/zephyr,holtmann/zephyr,zephyrproject-rtos/zephyr,sharronliu/zephyr,aceofall/zephyr-iotos,GiulianoFranchetto/zephyr,runchip/zephyr-cc3220,fractalclone/zephyr-riscv,nashif/zephyr,kraj/zephyr,explora26/zephyr,galak/zephyr,Vudentz/zephyr,nashif/zephyr,pklazy/zephyr,aceofall/zephyr-iotos,mbolivar/zephyr,holtmann/zephyr,finikorg/zephyr,fbsder/zephyr,zephyrproject-rtos/zephyr,runchip/zephyr-cc3220,bigdinotech/zephyr,fbsder/zephyr,fbsder/zephyr,sharronliu/zephyr,explora26/zephyr,pklazy/zephyr,Vudentz/zephyr,pklazy/zephyr,zephyriot/zephyr,holtmann/zephyr,erwango/zephyr,GiulianoFranchetto/zephyr,nashif/zephyr,pklazy/zephyr,punitvara/zephyr,kraj/zephyr,finikorg/zephyr,erwango/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,runchip/zephyr-cc3220,erwango/zephyr,rsalveti/zephyr,fbsder/zephyr,aceofall/zephyr-iotos,erwango/zephyr,mbolivar/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,fractalclone/zephyr-riscv,GiulianoFranchetto/zephyr,runchip/zephyr-cc3220,mbolivar/zephyr,kraj/zephyr,sharronliu/zephyr,rsalveti/zephyr,zephyriot/zephyr,fractalclone/zephyr-riscv,galak/zephyr,kraj/zephyr,galak/zephyr