CHANGELOG.md (11600B)
1 # v0.10.2 - 2023/03/20 2 3 ### New features 4 5 * Support DebugDOT option for debugging encoder ( #440 ) 6 7 ### Fix bugs 8 9 * Fix combination of embedding structure and omitempty option ( #442 ) 10 11 # v0.10.1 - 2023/03/13 12 13 ### Fix bugs 14 15 * Fix checkptr error for array decoder ( #415 ) 16 * Fix added buffer size check when decoding key ( #430 ) 17 * Fix handling of anonymous fields other than struct ( #431 ) 18 * Fix to not optimize when lower conversion can't handle byte-by-byte ( #432 ) 19 * Fix a problem that MarshalIndent does not work when UnorderedMap is specified ( #435 ) 20 * Fix mapDecoder.DecodeStream() for empty objects containing whitespace ( #425 ) 21 * Fix an issue that could not set the correct NextField for fields in the embedded structure ( #438 ) 22 23 # v0.10.0 - 2022/11/29 24 25 ### New features 26 27 * Support JSON Path ( #250 ) 28 29 ### Fix bugs 30 31 * Fix marshaler for map's key ( #409 ) 32 33 # v0.9.11 - 2022/08/18 34 35 ### Fix bugs 36 37 * Fix unexpected behavior when buffer ends with backslash ( #383 ) 38 * Fix stream decoding of escaped character ( #387 ) 39 40 # v0.9.10 - 2022/07/15 41 42 ### Fix bugs 43 44 * Fix boundary exception of type caching ( #382 ) 45 46 # v0.9.9 - 2022/07/15 47 48 ### Fix bugs 49 50 * Fix encoding of directed interface with typed nil ( #377 ) 51 * Fix embedded primitive type encoding using alias ( #378 ) 52 * Fix slice/array type encoding with types implementing MarshalJSON ( #379 ) 53 * Fix unicode decoding when the expected buffer state is not met after reading ( #380 ) 54 55 # v0.9.8 - 2022/06/30 56 57 ### Fix bugs 58 59 * Fix decoding of surrogate-pair ( #365 ) 60 * Fix handling of embedded primitive type ( #366 ) 61 * Add validation of escape sequence for decoder ( #367 ) 62 * Fix stream tokenizing respecting UseNumber ( #369 ) 63 * Fix encoding when struct pointer type that implements Marshal JSON is embedded ( #375 ) 64 65 ### Improve performance 66 67 * Improve performance of linkRecursiveCode ( #368 ) 68 69 # v0.9.7 - 2022/04/22 70 71 ### Fix bugs 72 73 #### Encoder 74 75 * Add filtering process for encoding on slow path ( #355 ) 76 * Fix encoding of interface{} with pointer type ( #363 ) 77 78 #### Decoder 79 80 * Fix map key decoder that implements UnmarshalJSON ( #353 ) 81 * Fix decoding of []uint8 type ( #361 ) 82 83 ### New features 84 85 * Add DebugWith option for encoder ( #356 ) 86 87 # v0.9.6 - 2022/03/22 88 89 ### Fix bugs 90 91 * Correct the handling of the minimum value of int type for decoder ( #344 ) 92 * Fix bugs of stream decoder's bufferSize ( #349 ) 93 * Add a guard to use typeptr more safely ( #351 ) 94 95 ### Improve decoder performance 96 97 * Improve escapeString's performance ( #345 ) 98 99 ### Others 100 101 * Update go version for CI ( #347 ) 102 103 # v0.9.5 - 2022/03/04 104 105 ### Fix bugs 106 107 * Fix panic when decoding time.Time with context ( #328 ) 108 * Fix reading the next character in buffer to nul consideration ( #338 ) 109 * Fix incorrect handling on skipValue ( #341 ) 110 111 ### Improve decoder performance 112 113 * Improve performance when a payload contains escape sequence ( #334 ) 114 115 # v0.9.4 - 2022/01/21 116 117 * Fix IsNilForMarshaler for string type with omitempty ( #323 ) 118 * Fix the case where the embedded field is at the end ( #326 ) 119 120 # v0.9.3 - 2022/01/14 121 122 * Fix logic of removing struct field for decoder ( #322 ) 123 124 # v0.9.2 - 2022/01/14 125 126 * Add invalid decoder to delay type error judgment at decode ( #321 ) 127 128 # v0.9.1 - 2022/01/11 129 130 * Fix encoding of MarshalText/MarshalJSON operation with head offset ( #319 ) 131 132 # v0.9.0 - 2022/01/05 133 134 ### New feature 135 136 * Supports dynamic filtering of struct fields ( #314 ) 137 138 ### Improve encoding performance 139 140 * Improve map encoding performance ( #310 ) 141 * Optimize encoding path for escaped string ( #311 ) 142 * Add encoding option for performance ( #312 ) 143 144 ### Fix bugs 145 146 * Fix panic at encoding map value on 1.18 ( #310 ) 147 * Fix MarshalIndent for interface type ( #317 ) 148 149 # v0.8.1 - 2021/12/05 150 151 * Fix operation conversion from PtrHead to Head in Recursive type ( #305 ) 152 153 # v0.8.0 - 2021/12/02 154 155 * Fix embedded field conflict behavior ( #300 ) 156 * Refactor compiler for encoder ( #301 #302 ) 157 158 # v0.7.10 - 2021/10/16 159 160 * Fix conversion from pointer to uint64 ( #294 ) 161 162 # v0.7.9 - 2021/09/28 163 164 * Fix encoding of nil value about interface type that has method ( #291 ) 165 166 # v0.7.8 - 2021/09/01 167 168 * Fix mapassign_faststr for indirect struct type ( #283 ) 169 * Fix encoding of not empty interface type ( #284 ) 170 * Fix encoding of empty struct interface type ( #286 ) 171 172 # v0.7.7 - 2021/08/25 173 174 * Fix invalid utf8 on stream decoder ( #279 ) 175 * Fix buffer length bug on string stream decoder ( #280 ) 176 177 Thank you @orisano !! 178 179 # v0.7.6 - 2021/08/13 180 181 * Fix nil slice assignment ( #276 ) 182 * Improve error message ( #277 ) 183 184 # v0.7.5 - 2021/08/12 185 186 * Fix encoding of embedded struct with tags ( #265 ) 187 * Fix encoding of embedded struct that isn't first field ( #272 ) 188 * Fix decoding of binary type with escaped char ( #273 ) 189 190 # v0.7.4 - 2021/07/06 191 192 * Fix encoding of indirect layout structure ( #264 ) 193 194 # v0.7.3 - 2021/06/29 195 196 * Fix encoding of pointer type in empty interface ( #262 ) 197 198 # v0.7.2 - 2021/06/26 199 200 ### Fix decoder 201 202 * Add decoder for func type to fix decoding of nil function value ( #257 ) 203 * Fix stream decoding of []byte type ( #258 ) 204 205 ### Performance 206 207 * Improve decoding performance of map[string]interface{} type ( use `mapassign_faststr` ) ( #256 ) 208 * Improve encoding performance of empty interface type ( remove recursive calling of `vm.Run` ) ( #259 ) 209 210 ### Benchmark 211 212 * Add bytedance/sonic as benchmark target ( #254 ) 213 214 # v0.7.1 - 2021/06/18 215 216 ### Fix decoder 217 218 * Fix error when unmarshal empty array ( #253 ) 219 220 # v0.7.0 - 2021/06/12 221 222 ### Support context for MarshalJSON and UnmarshalJSON ( #248 ) 223 224 * json.MarshalContext(context.Context, interface{}, ...json.EncodeOption) ([]byte, error) 225 * json.NewEncoder(io.Writer).EncodeContext(context.Context, interface{}, ...json.EncodeOption) error 226 * json.UnmarshalContext(context.Context, []byte, interface{}, ...json.DecodeOption) error 227 * json.NewDecoder(io.Reader).DecodeContext(context.Context, interface{}) error 228 229 ```go 230 type MarshalerContext interface { 231 MarshalJSON(context.Context) ([]byte, error) 232 } 233 234 type UnmarshalerContext interface { 235 UnmarshalJSON(context.Context, []byte) error 236 } 237 ``` 238 239 ### Add DecodeFieldPriorityFirstWin option ( #242 ) 240 241 In the default behavior, go-json, like encoding/json, will reflect the result of the last evaluation when a field with the same name exists. I've added new options to allow you to change this behavior. `json.DecodeFieldPriorityFirstWin` option reflects the result of the first evaluation if a field with the same name exists. This behavior has a performance advantage as it allows the subsequent strings to be skipped if all fields have been evaluated. 242 243 ### Fix encoder 244 245 * Fix indent number contains recursive type ( #249 ) 246 * Fix encoding of using empty interface as map key ( #244 ) 247 248 ### Fix decoder 249 250 * Fix decoding fields containing escaped characters ( #237 ) 251 252 ### Refactor 253 254 * Move some tests to subdirectory ( #243 ) 255 * Refactor package layout for decoder ( #238 ) 256 257 # v0.6.1 - 2021/06/02 258 259 ### Fix encoder 260 261 * Fix value of totalLength for encoding ( #236 ) 262 263 # v0.6.0 - 2021/06/01 264 265 ### Support Colorize option for encoding (#233) 266 267 ```go 268 b, err := json.MarshalWithOption(v, json.Colorize(json.DefaultColorScheme)) 269 if err != nil { 270 ... 271 } 272 fmt.Println(string(b)) // print colored json 273 ``` 274 275 ### Refactor 276 277 * Fix opcode layout - Adjust memory layout of the opcode to 128 bytes in a 64-bit environment ( #230 ) 278 * Refactor encode option ( #231 ) 279 * Refactor escape string ( #232 ) 280 281 # v0.5.1 - 2021/5/20 282 283 ### Optimization 284 285 * Add type addrShift to enable bigger encoder/decoder cache ( #213 ) 286 287 ### Fix decoder 288 289 * Keep original reference of slice element ( #229 ) 290 291 ### Refactor 292 293 * Refactor Debug mode for encoding ( #226 ) 294 * Generate VM sources for encoding ( #227 ) 295 * Refactor validator for null/true/false for decoding ( #221 ) 296 297 # v0.5.0 - 2021/5/9 298 299 ### Supports using omitempty and string tags at the same time ( #216 ) 300 301 ### Fix decoder 302 303 * Fix stream decoder for unicode char ( #215 ) 304 * Fix decoding of slice element ( #219 ) 305 * Fix calculating of buffer length for stream decoder ( #220 ) 306 307 ### Refactor 308 309 * replace skipWhiteSpace goto by loop ( #212 ) 310 311 # v0.4.14 - 2021/5/4 312 313 ### Benchmark 314 315 * Add valyala/fastjson to benchmark ( #193 ) 316 * Add benchmark task for CI ( #211 ) 317 318 ### Fix decoder 319 320 * Fix decoding of slice with unmarshal json type ( #198 ) 321 * Fix decoding of null value for interface type that does not implement Unmarshaler ( #205 ) 322 * Fix decoding of null value to []byte by json.Unmarshal ( #206 ) 323 * Fix decoding of backslash char at the end of string ( #207 ) 324 * Fix stream decoder for null/true/false value ( #208 ) 325 * Fix stream decoder for slow reader ( #211 ) 326 327 ### Performance 328 329 * If cap of slice is enough, reuse slice data for compatibility with encoding/json ( #200 ) 330 331 # v0.4.13 - 2021/4/20 332 333 ### Fix json.Compact and json.Indent 334 335 * Support validation the input buffer for json.Compact and json.Indent ( #189 ) 336 * Optimize json.Compact and json.Indent ( improve memory footprint ) ( #190 ) 337 338 # v0.4.12 - 2021/4/15 339 340 ### Fix encoder 341 342 * Fix unnecessary indent for empty slice type ( #181 ) 343 * Fix encoding of omitempty feature for the slice or interface type ( #183 ) 344 * Fix encoding custom types zero values with omitempty when marshaller exists ( #187 ) 345 346 ### Fix decoder 347 348 * Fix decoder for invalid top level value ( #184 ) 349 * Fix decoder for invalid number value ( #185 ) 350 351 # v0.4.11 - 2021/4/3 352 353 * Improve decoder performance for interface type 354 355 # v0.4.10 - 2021/4/2 356 357 ### Fix encoder 358 359 * Fixed a bug when encoding slice and map containing recursive structures 360 * Fixed a logic to determine if indirect reference 361 362 # v0.4.9 - 2021/3/29 363 364 ### Add debug mode 365 366 If you use `json.MarshalWithOption(v, json.Debug())` and `panic` occurred in `go-json`, produces debug information to console. 367 368 ### Support a new feature to compatible with encoding/json 369 370 - invalid UTF-8 is coerced to valid UTF-8 ( without performance down ) 371 372 ### Fix encoder 373 374 - Fixed handling of MarshalJSON of function type 375 376 ### Fix decoding of slice of pointer type 377 378 If there is a pointer value, go-json will use it. (This behavior is necessary to achieve the ability to prioritize pre-filled values). However, since slices are reused internally, there was a bug that referred to the previous pointer value. Therefore, it is not necessary to refer to the pointer value in advance for the slice element, so we explicitly initialize slice element by `nil`. 379 380 # v0.4.8 - 2021/3/21 381 382 ### Reduce memory usage at compile time 383 384 * go-json have used about 2GB of memory at compile time, but now it can compile with about less than 550MB. 385 386 ### Fix any encoder's bug 387 388 * Add many test cases for encoder 389 * Fix composite type ( slice/array/map ) 390 * Fix pointer types 391 * Fix encoding of MarshalJSON or MarshalText or json.Number type 392 393 ### Refactor encoder 394 395 * Change package layout for reducing memory usage at compile 396 * Remove anonymous and only operation 397 * Remove root property from encodeCompileContext and opcode 398 399 ### Fix CI 400 401 * Add Go 1.16 402 * Remove Go 1.13 403 * Fix `make cover` task 404 405 ### Number/Delim/Token/RawMessage use the types defined in encoding/json by type alias 406 407 # v0.4.7 - 2021/02/22 408 409 ### Fix decoder 410 411 * Fix decoding of deep recursive structure 412 * Fix decoding of embedded unexported pointer field 413 * Fix invalid test case 414 * Fix decoding of invalid value 415 * Fix decoding of prefilled value 416 * Fix not being able to return UnmarshalTypeError when it should be returned 417 * Fix decoding of null value 418 * Fix decoding of type of null string 419 * Use pre allocated pointer if exists it at decoding 420 421 ### Reduce memory usage at compile 422 423 * Integrate int/int8/int16/int32/int64 and uint/uint8/uint16/uint32/uint64 operation to reduce memory usage at compile 424 425 ### Remove unnecessary optype