0

I'm reading RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt). In para 2.1, It talks about three literal names true, false, null.

     false = %x66.61.6c.73.65   ; false

     null  = %x6e.75.6c.6c      ; null

     true  = %x74.72.75.65      ; true

I am totally lost here. Does anyone know what %x66.61.6c.73.65 mean? Thanks.

zubair
  • 407
  • 1
  • 5
  • 7
  • 1
    I think it's the hex characters for those words. – Hot Licks Jan 11 '13 at 13:27
  • Anyone know where this convention comes from? I've never seen anyone write hex or "pseudo-hex" as `%x77.72.75.65` -- I feel like `\x72\x77\x75...` or `0x74727565` or `0x72 0x72 ...` is more common and understandable. Just curious, maybe the form used in the JSON RFC is or was commonplace in the past? Anyone know? – Kasapo Jun 01 '16 at 18:57

2 Answers2

2

They're the bytes used for those words. In short, the text is to be encoded in ASCII (or the equivalent) and no other encoding.

>>> print '\x66\x61\x6c\x73\x65'
false
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
2

at first sight these seem to be the ascii codes for the letters :

  • false = "f"+"a"+"l"+"s"+"e" eg : char(0x65)+char(0x61)+char(0x6c)+char(0x73)+char(0x65)
dweeves
  • 5,525
  • 22
  • 28