@@ -131,8 +131,8 @@ func parseValue(s string, c *cache, depth int) (*Value, string, error) {
131131 return nil , tail , fmt .Errorf ("cannot parse string: %s" , err )
132132 }
133133 v := c .getValue ()
134- v .t = typeRawString
135- v .s = ss
134+ v .t = TypeString
135+ v .s = unescapeStringBestEffort ( ss )
136136 return v , tail , nil
137137 }
138138 if s [0 ] == 't' {
@@ -326,7 +326,7 @@ func escapeStringSlowPath(dst []byte, s string) []byte {
326326 dst = append (dst , []byte {'\\' , 'u' , '0' , '0' , '0' , 0x57 + c }... )
327327 case c < 0x1a :
328328 dst = append (dst , []byte {'\\' , 'u' , '0' , '0' , '1' , 0x20 + c }... )
329- case c < 0x20 :
329+ case c < 0x20 : // lint:ignore
330330 dst = append (dst , []byte {'\\' , 'u' , '0' , '0' , '1' , 0x47 + c }... )
331331 }
332332 }
@@ -618,11 +618,6 @@ type Value struct {
618618// MarshalTo appends marshaled v to dst and returns the result.
619619func (v * Value ) MarshalTo (dst []byte ) []byte {
620620 switch v .t {
621- case typeRawString :
622- dst = append (dst , '"' )
623- dst = append (dst , v .s ... )
624- dst = append (dst , '"' )
625- return dst
626621 case TypeObject :
627622 return v .o .MarshalTo (dst )
628623 case TypeArray :
@@ -688,8 +683,6 @@ const (
688683
689684 // TypeFalse is JSON false.
690685 TypeFalse Type = 6
691-
692- typeRawString Type = 7
693686)
694687
695688// String returns string representation of t.
@@ -719,10 +712,6 @@ func (t Type) String() string {
719712
720713// Type returns the type of the v.
721714func (v * Value ) Type () Type {
722- if v .t == typeRawString {
723- v .s = unescapeStringBestEffort (v .s )
724- v .t = TypeString
725- }
726715 return v .t
727716}
728717
0 commit comments