package fastjson

import (
	
	
)

// Del deletes the entry with the given key from o.
func ( *Object) ( string) {
	if  == nil {
		return
	}
	if !.keysUnescaped && strings.IndexByte(, '\\') < 0 {
		// Fast path - try searching for the key without object keys unescaping.
		for ,  := range .kvs {
			if .k ==  {
				.kvs = append(.kvs[:], .kvs[+1:]...)
				return
			}
		}
	}

	// Slow path - unescape object keys before item search.
	.unescapeKeys()

	for ,  := range .kvs {
		if .k ==  {
			.kvs = append(.kvs[:], .kvs[+1:]...)
			return
		}
	}
}

// Del deletes the entry with the given key from array or object v.
func ( *Value) ( string) {
	if  == nil {
		return
	}
	if .t == TypeObject {
		.o.Del()
		return
	}
	if .t == TypeArray {
		,  := strconv.Atoi()
		if  != nil ||  < 0 ||  >= len(.a) {
			return
		}
		.a = append(.a[:], .a[+1:]...)
	}
}

// Set sets (key, value) entry in the o.
//
// The value must be unchanged during o lifetime.
func ( *Object) ( string,  *Value) {
	if  == nil {
		return
	}
	if  == nil {
		 = valueNull
	}
	.unescapeKeys()

	// Try substituting already existing entry with the given key.
	for  := range .kvs {
		 := &.kvs[]
		if .k ==  {
			.v = 
			return
		}
	}

	// Add new entry.
	 := .getKV()
	.k = 
	.v = 
}

// Set sets (key, value) entry in the array or object v.
//
// The value must be unchanged during v lifetime.
func ( *Value) ( string,  *Value) {
	if  == nil {
		return
	}
	if .t == TypeObject {
		.o.Set(, )
		return
	}
	if .t == TypeArray {
		,  := strconv.Atoi()
		if  != nil ||  < 0 {
			return
		}
		.SetArrayItem(, )
	}
}

// SetArrayItem sets the value in the array v at idx position.
//
// The value must be unchanged during v lifetime.
func ( *Value) ( int,  *Value) {
	if  == nil || .t != TypeArray {
		return
	}
	for  >= len(.a) {
		.a = append(.a, valueNull)
	}
	.a[] = 
}