[165] | 1 | .. _api-zoo-format-json: |
---|
| 2 | |
---|
| 3 | ZOO.Format.JSON |
---|
| 4 | =============== |
---|
| 5 | |
---|
| 6 | A parser to read/write JSON safely. |
---|
| 7 | |
---|
| 8 | Properties |
---|
| 9 | ---------- |
---|
| 10 | |
---|
| 11 | .. list-table:: |
---|
| 12 | :widths: 12 50 |
---|
| 13 | :header-rows: 1 |
---|
| 14 | |
---|
| 15 | * - NAME |
---|
| 16 | - DESCRIPTION |
---|
| 17 | * - :ref:`indent <indent>` |
---|
| 18 | - {String} For "pretty" printing, the indent string will be used once for each indentation level. |
---|
| 19 | * - :ref:`space <space>` |
---|
| 20 | - {String} For "pretty" printing, the space string will be used after the ":" separating a name/value pair. |
---|
| 21 | * - :ref:`newline <newline>` |
---|
| 22 | - {String} For "pretty" printing, the newline string will be used at the end of each name/value pair or array item. |
---|
| 23 | * - :ref:`level <level>` |
---|
| 24 | - {Integer} For "pretty" printing, this is incremented/decremented during serialization. |
---|
| 25 | * - :ref:`pretty <pretty>` |
---|
| 26 | - {Boolean} Serialize with extra whitespace for structure. |
---|
| 27 | |
---|
| 28 | Functions |
---|
| 29 | --------- |
---|
| 30 | |
---|
| 31 | .. list-table:: |
---|
| 32 | :widths: 14 50 |
---|
| 33 | :header-rows: 1 |
---|
| 34 | |
---|
| 35 | * - NAME |
---|
| 36 | - DESCRIPTION |
---|
| 37 | * - :ref:`ZOO.Format.JSON <ZOO.Format.JSON>` |
---|
| 38 | - Create a new parser for JSON. |
---|
| 39 | * - :ref:`read <read>` |
---|
| 40 | - Deserialize a json string. |
---|
| 41 | * - :ref:`write <write>` |
---|
| 42 | - Serialize an object into a JSON string. |
---|
| 43 | * - :ref:`writeIndent <writeIndent>` |
---|
| 44 | - Output an indentation string depending on the indentation level. |
---|
| 45 | * - :ref:`writeNewline <writeNewline>` |
---|
| 46 | - Output a string representing a newline if in pretty printing mode. |
---|
| 47 | * - :ref:`writeSpace <writeSpace>` |
---|
| 48 | - Output a string representing a space if in pretty printing mode. |
---|
| 49 | |
---|
| 50 | Serialize Properties |
---|
| 51 | -------------------- |
---|
| 52 | |
---|
| 53 | .. list-table:: |
---|
| 54 | :widths: 14 50 |
---|
| 55 | :header-rows: 1 |
---|
| 56 | |
---|
| 57 | * - NAME |
---|
| 58 | - DESCRIPTION |
---|
| 59 | * - :ref:`serialize <serialize>` |
---|
| 60 | - Object with properties corresponding to the serializable data types. |
---|
| 61 | |
---|
| 62 | Serialize Functions |
---|
| 63 | ------------------- |
---|
| 64 | |
---|
| 65 | .. list-table:: |
---|
| 66 | :widths: 14 50 |
---|
| 67 | :header-rows: 1 |
---|
| 68 | |
---|
| 69 | * - NAME |
---|
| 70 | - DESCRIPTION |
---|
| 71 | * - :ref:`serialize.object <serialize.object>` |
---|
| 72 | - Transform an object into a JSON string. |
---|
| 73 | * - :ref:`serialize.array <serialize.array>` |
---|
| 74 | - Transform an array into a JSON string. |
---|
| 75 | * - :ref:`serialize.string <serialize.string>` |
---|
| 76 | - Transform a string into a JSON string. |
---|
| 77 | * - :ref:`serialize.number <serialize.number>` |
---|
| 78 | - Transform a number into a JSON string. |
---|
| 79 | * - :ref:`serialize.boolean <serialize.boolean>` |
---|
| 80 | - Transform a boolean into a JSON string. |
---|
| 81 | * - :ref:`serialize.date <serialize.date>` |
---|
| 82 | - Transform a date into a JSON string. |
---|
| 83 | |
---|
| 84 | **Properties** |
---|
| 85 | |
---|
| 86 | .. _indent: |
---|
| 87 | |
---|
| 88 | indent |
---|
| 89 | {String} For "pretty" printing, the indent string will be used once for each indentation level. |
---|
| 90 | |
---|
| 91 | .. _space: |
---|
| 92 | |
---|
| 93 | space |
---|
| 94 | {String} For "pretty" printing, the space string will be used after the ":" separating a name/value pair. |
---|
| 95 | |
---|
| 96 | .. _newline: |
---|
| 97 | |
---|
| 98 | newline |
---|
| 99 | {String} For "pretty" printing, the newline string will be used at the end of each name/value pair or array item. |
---|
| 100 | |
---|
| 101 | .. _level: |
---|
| 102 | |
---|
| 103 | level |
---|
| 104 | {Integer} For "pretty" printing, this is incremented/decremented during serialization. |
---|
| 105 | |
---|
| 106 | .. _pretty: |
---|
| 107 | |
---|
| 108 | pretty |
---|
| 109 | {Boolean} Serialize with extra whitespace for structure. |
---|
| 110 | |
---|
| 111 | **Functions** |
---|
| 112 | |
---|
| 113 | .. _ZOO.Format.JSON: |
---|
| 114 | |
---|
| 115 | ZOO.Format.JSON |
---|
| 116 | Create a new parser for JSON. |
---|
| 117 | |
---|
| 118 | .. _read: |
---|
| 119 | |
---|
| 120 | read |
---|
| 121 | Deserialize a json string. |
---|
| 122 | |
---|
| 123 | .. _write: |
---|
| 124 | |
---|
| 125 | write |
---|
| 126 | Serialize an object into a JSON string. |
---|
| 127 | |
---|
| 128 | .. _writeIndent: |
---|
| 129 | |
---|
| 130 | writeIndent |
---|
| 131 | Output an indentation string depending on the indentation level. |
---|
| 132 | |
---|
| 133 | .. _writeNewline: |
---|
| 134 | |
---|
| 135 | writeNewline |
---|
| 136 | Output a string representing a newline if in pretty printing mode. |
---|
| 137 | |
---|
| 138 | .. _writeSpace: |
---|
| 139 | |
---|
| 140 | writeSpace |
---|
| 141 | Output a string representing a space if in pretty printing mode. |
---|
| 142 | |
---|
| 143 | **Serialize Properties** |
---|
| 144 | |
---|
| 145 | .. _serialize: |
---|
| 146 | |
---|
| 147 | serialize |
---|
| 148 | Object with properties corresponding to the serializable data types. |
---|
| 149 | |
---|
| 150 | **Serialize Functions** |
---|
| 151 | |
---|
| 152 | .. _serialize.object: |
---|
| 153 | |
---|
| 154 | serialize.object |
---|
| 155 | Transform an object into a JSON string. |
---|
| 156 | |
---|
| 157 | .. _serialize.array: |
---|
| 158 | |
---|
| 159 | serialize.array |
---|
| 160 | Transform an array into a JSON string. |
---|
| 161 | |
---|
| 162 | .. _serialize.string: |
---|
| 163 | |
---|
| 164 | serialize.string |
---|
| 165 | Transform a string into a JSON string. |
---|
| 166 | |
---|
| 167 | .. _serialize.number: |
---|
| 168 | |
---|
| 169 | serialize.number |
---|
| 170 | Transform a number into a JSON string. |
---|
| 171 | |
---|
| 172 | .. _serialize.boolean: |
---|
| 173 | |
---|
| 174 | serialize.boolean |
---|
| 175 | Transform a boolean into a JSON string. |
---|
| 176 | |
---|
| 177 | .. _serialize.date: |
---|
| 178 | |
---|
| 179 | serialize.date |
---|
| 180 | Transform a date into a JSON string. |
---|