[RFC PATCH 2/6] telemetry: fix escaping of invalid json characters

Stephen Hemminger stephen at networkplumber.org
Thu Jun 23 20:39:34 CEST 2022


On Thu, 23 Jun 2022 20:34:07 +0200
Morten Brørup <mb at smartsharesystems.com> wrote:

> > From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> > Sent: Thursday, 23 June 2022 18.43
> > 
> > For string values returned from telemetry, escape any values that
> > cannot
> > normally appear in a json string. According to the json spec[1], the
> > characters than need to be handled are control chars (char value <
> > 0x20)
> > and '"' and '\' characters.  
> 
> Correct. Other chars are optional to escape.

For json_writer (which I wrote for iproute2 and could have been used here).
The switch handles: \t \n \r \f \b \\ " ' as special cases.


More information about the dev mailing list