[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200427160757.38ebc7a5@hermes.lan>
Date: Mon, 27 Apr 2020 16:07:57 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: David Ahern <dsahern@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>, Xin Long <lucien.xin@...il.com>,
network dev <netdev@...r.kernel.org>,
Simon Horman <simon.horman@...ronome.com>
Subject: Re: [PATCHv3 iproute2-next 3/7] iproute_lwtunnel: add options
support for erspan metadata
On Mon, 27 Apr 2020 06:38:03 -0600
David Ahern <dsahern@...il.com> wrote:
> On 4/23/20 12:03 PM, Jakub Kicinski wrote:
> > On Thu, 23 Apr 2020 08:23:51 -0700 Stephen Hemminger wrote:
> >> 3. If non json uses hex, then json should use hex
> >> json is type less so { "ver":2 } and { "ver":"0x2" } are the same
> >
> > I may be missing something or misunderstanding you, but in my humble
> > experience that's emphatically not true:
> >
> > $ echo '{ "a" : 2 }' | python -c 'import sys, json; print(json.load(sys.stdin)["a"] + 1)'
> > 3
> > $ echo '{ "a" : "2" }' | python -c 'import sys, json; print(json.load(sys.stdin)["a"] + 1)'
> > Traceback (most recent call last):
> > File "<string>", line 1, in <module>
> > TypeError: can only concatenate str (not "int") to str
> >
>
> I don't know which site is the definitive source for json, but several
> do state json has several types - strings, number, true / false / null,
> object, array.
Probably I got confused because Python tries to be helpful...
JSON is ossified/standardized http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
Best answer on the web was https://stackoverflow.com/questions/52671719/can-hex-format-be-used-with-json-files-if-so-how
"JSON does not support hexadecimal numbers but they are supported in JSON5. json5.org"
Powered by blists - more mailing lists