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:18] – 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, ...
-}+
  
  
 Another common data type is binary data, which is commonly used for image. However, we can use the same solution for binary data. Another common data type is binary data, which is commonly used for image. However, we can use the same solution for binary data.
  
-===== String notation of datetime and binary. =====+==== String notation of datetime and binary. ====
  
 The following is a string and object presentasion of DateTime and Binary data. The following is a string and object presentasion of DateTime and Binary data.
Line 29: Line 29:
   * The object presentaion of binary data is "_%". where refer to either 64 (base64) or 85 (z85) encoding method. And data is the string encoding of the binary data of the correspnding encoding method.   * The object presentaion of binary data is "_%". where refer to either 64 (base64) or 85 (z85) encoding method. And data is the string encoding of the binary data of the correspnding encoding method.
  
-===== Object notation of datetime and binary. =====+==== Object notation of datetime and binary. ====
  
 The object presentation of datetime and binary data use a class specifier, _cls. The available _cls are: The object presentation of datetime and binary data use a class specifier, _cls. The available _cls are:
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 ====
Line 96: Line 98:
 ==== 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 ====
en/xjson.1780478326.txt.gzip · Last modified: by administrator