Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions util/jsonutil/jsonutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ import (
"github.com/prebid/prebid-server/v3/errortypes"
)

var comma = byte(',')
var colon = byte(':')
var sqBracket = byte(']')
var closingCurlyBracket = byte('}')
const (
comma byte = ','
colon byte = ':'
sqBracket byte = ']'
closingCurlyBracket byte = '}'
)

// RawMessage to allow replacing json with jsonutil
type RawMessage = json.RawMessage

// Finds element in json byte array with any level of nesting
// FindElement finds element in json byte array with any level of nesting
func FindElement(extension []byte, elementNames ...string) (bool, int64, int64, error) {
elementName := elementNames[0]
buf := bytes.NewBuffer(extension)
Expand Down Expand Up @@ -100,7 +105,7 @@ func FindElement(extension []byte, elementNames ...string) (bool, int64, int64,
return found, startIndex, endIndex, nil
}

// Drops element from json byte array
// DropElement drops element from json byte array
// - Doesn't support drop element from json list
// - Keys in the path can skip levels
// - First found element will be removed
Expand Down
Loading