Browse Source

Add json.is_valid

gingerBill 6 years ago
parent
commit
9487f8c92e
1 changed files with 3 additions and 2 deletions
  1. 3 2
      core/encoding/json/parser.odin

+ 3 - 2
core/encoding/json/parser.odin

@@ -3,7 +3,6 @@ package json
 import "core:mem"
 import "core:mem"
 import "core:unicode/utf8"
 import "core:unicode/utf8"
 import "core:strconv"
 import "core:strconv"
-import "core:strings"
 
 
 Parser :: struct {
 Parser :: struct {
 	tok:        Tokenizer,
 	tok:        Tokenizer,
@@ -247,7 +246,9 @@ unquote_string :: proc(token: Token, allocator := context.allocator) -> string {
 		i += w;
 		i += w;
 	}
 	}
 	if i == len(s) {
 	if i == len(s) {
-		return strings.new_string(s, allocator);
+		b := make([]byte, len(s), allocator);
+		copy(b, cast([]byte)s);
+		return string(b);
 	}
 	}
 
 
 	b := make([]byte, len(s) + 2*utf8.UTF_MAX, allocator);
 	b := make([]byte, len(s) + 2*utf8.UTF_MAX, allocator);