You've already forked json-iterator
							
							
				mirror of
				https://github.com/json-iterator/go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	| @@ -2,11 +2,12 @@ package jsoniter | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"github.com/modern-go/reflect2" | ||||
| 	"io" | ||||
| 	"reflect" | ||||
| 	"sort" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"github.com/modern-go/reflect2" | ||||
| ) | ||||
|  | ||||
| func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { | ||||
| @@ -106,15 +107,17 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if typ == textMarshalerType { | ||||
| 		return &directTextMarshalerEncoder{ | ||||
| 			stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), | ||||
| 	if typ.Kind() != reflect.String { | ||||
| 		if typ == textMarshalerType { | ||||
| 			return &directTextMarshalerEncoder{ | ||||
| 				stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	if typ.Implements(textMarshalerType) { | ||||
| 		return &textMarshalerEncoder{ | ||||
| 			valType:       typ, | ||||
| 			stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), | ||||
| 		if typ.Implements(textMarshalerType) { | ||||
| 			return &textMarshalerEncoder{ | ||||
| 				valType:       typ, | ||||
| 				stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user