User Tools

Site Tools


en:xjson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:xjson [2026/06/03 09:15] – administratoren:xjson [2026/06/03 09:56] (current) – [XJSON] administrator
Line 13: Line 13:
 Alternative, we can provide the object class name in a special attribute, say _cls. The receiver then look for this class attribute on each received object. Alternative, we can provide the object class name in a special attribute, say _cls. The receiver then look for this class attribute on each received object.
  
-{+
   "_cls": "datetime",   "_cls": "datetime",
   "year": 2000, ...   "year": 2000, ...
-}+
  
  
Line 37: Line 37:
   * _cls: base64, or z85 (binary)   * _cls: base64, or z85 (binary)
  
-==== XJSON ====+===== XJSON =====
  
 There are two other issues in JSON. The first issue is that it must be an object, that is the notation must start with a curly bracket. There are two other issues in JSON. The first issue is that it must be an object, that is the notation must start with a curly bracket.
Line 65: Line 65:
 The following is an example of an XJSON object, or a key-value pair dictionary. Note that attribute (or dictionary key) does not needed to be quoted, although you can. You cannot use number as attribute. Attribute must be a single word without space in between. The following is an example of an XJSON object, or a key-value pair dictionary. Note that attribute (or dictionary key) does not needed to be quoted, although you can. You cannot use number as attribute. Attribute must be a single word without space in between.
  
-{+ 
 +    {
     feedback : 1,     feedback : 1,
     changeset : {     changeset : {
Line 84: Line 85:
     locked: F,     locked: F,
     icon: _HA09EFJKI===,     icon: _HA09EFJKI===,
-}+    } 
  
 This is an example for a XJSON for a list instead of an object. It can also be a number or a string too. This is an example for a XJSON for a list instead of an object. It can also be a number or a string too.
  
-[ 1, 2, "Red", DT12, ]+  [ 1, 2, "Red", DT12, ]
  
-=== Notes on Boolean ===+==== Notes on Boolean ====
  
 T or True, or TT are the same since we first character already tell the type. Similar to F and False. T or True, or TT are the same since we first character already tell the type. Similar to F and False.
  
-=== Notes on Number ===+==== Notes on Number ====
  
-  - The sign of a number is put at the end, eg. negative 123 is 123-+  * The sign of a number is put at the end, eg. negative 123 is 123-
  
-  - One can use exponential notation, eg. 1.234E4+  * One can use exponential notation, eg. 1.234E4
  
-  - Start a number 0x for hexidecimal.+  * Start a number 0x for hexidecimal.
  
-=== Notes on DateTime ===+==== Notes on DateTime ====
  
-  -   The full specification is D[YYYYMMDD][THHMMSS.ZZZ[+HHMM][+TZ]]+  * The full specification is D[YYYYMMDD][THHMMSS.ZZZ[+HHMM][+TZ]]
  
-  -   TZ refer to time zone, which is a number+  * TZ refer to time zone, which is a number
  
-  -   To specify time. just omit the date but still need to start with 'D'. Eg. DT12 for 12:00:00+  * To specify time. just omit the date but still need to start with 'D'. Eg. DT12 for 12:00:00
  
-=== Notes on String ===+==== Notes on String ====
  
-  - String is UTF8 encoded.+  *   String is UTF8 encoded.
  
-  - You can escape a character with backslash, . The possible escaped characters are \0 \b, \n, \r, \t, \Z, \, ', and ".+  * You can escape a character with backslash, . The possible escaped characters are \0 \b, \n, \r, \t, \Z, \, ', and ".
  
-=== Notes on Bytes ===+==== Notes on Bytes ====
  
 You shall put bytes data betwen pair of signle quote if you have space in bytes data. For example _'AJKIE JJAE'. Or you want to use different encoding method other than the default Base64. Eg, _z85'0JIU@-+' are binary data using Z85 encoding. You shall put bytes data betwen pair of signle quote if you have space in bytes data. For example _'AJKIE JJAE'. Or you want to use different encoding method other than the default Base64. Eg, _z85'0JIU@-+' are binary data using Z85 encoding.
  
-=== Notes on List and Dict ===+==== Notes on List and Dict ====
  
 You can leave the last item in a List or Dict blank. Eg [ 1, 2, 3, ] is accepted. So is { a: 1, b: 2, }. But you cannot have an empty item in between. Eg [ 1,,3 ] or { a: , b: 2 }, error. You can leave the last item in a List or Dict blank. Eg [ 1, 2, 3, ] is accepted. So is { a: 1, b: 2, }. But you cannot have an empty item in between. Eg [ 1,,3 ] or { a: , b: 2 }, error.
en/xjson.1780478126.txt.gzip · Last modified: by administrator