// Copyright 2017 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // See the License for the specific language governing permissions and // limitations under the License. package json import ( "bytes" "encoding/binary" "encoding/json" "fmt" "math" "reflect" "sort" "strconv" "strings" "unicode/utf8" "github.com/juju/errors" "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/hack" ) // BinaryJSON represents a binary encoded JSON object. // It can be randomly accessed without deserialization. type BinaryJSON struct { TypeCode TypeCode Value []byte } // htmlSafeSet holds the value true if the ASCII character with the given // array position can be safely represented inside a JSON string, embedded // inside of HTML