package protocol

import (
	
	
	
	

	
)
EscapeMode is the mode that should be use for escaping a value
The modes for escaping a value before it is marshaled, and unmarshaled.
EncodeJSONValue marshals the value into a JSON string, and optionally base64 encodes the string before returning it. Will panic if the escape mode is unknown.
func ( aws.JSONValue,  EscapeMode) (string, error) {
	,  := json.Marshal()
	if  != nil {
		return "", 
	}

	switch  {
	case NoEscape:
		return string(), nil
	case Base64Escape:
		return base64.StdEncoding.EncodeToString(), nil
	case QuotedEscape:
		return strconv.Quote(string()), nil
	}

	panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", ))
}
DecodeJSONValue will attempt to decode the string input as a JSONValue. Optionally decoding base64 the value first before JSON unmarshaling. Will panic if the escape mode is unknown.
func ( string,  EscapeMode) (aws.JSONValue, error) {
	var  []byte
	var  error

	switch  {
	case NoEscape:
		 = []byte()
	case Base64Escape:
		,  = base64.StdEncoding.DecodeString()
	case QuotedEscape:
		var  string
		,  = strconv.Unquote()
		 = []byte()
	default:
		panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", ))
	}

	if  != nil {
		return nil, 
	}

	 := aws.JSONValue{}
	 = json.Unmarshal(, &)
	if  != nil {
		return nil, 
	}

	return , nil