Processes the given array value and answers the resulting data.

@param array $value
@param boolean $json

@return mixed
168419
protected function processArray($value, $json = false)
    {
        if (is_array($value)) {
            
            if ($this->isCallbackArray($value)) {
                return $this->processCallbackArray($value);
            }
            
            return $json ? json_encode($value) : implode(', ', $value);
            
        }
        
        return $value;
    }
653553
protected function getValue($value, $event)
    {
        switch ($event) {
            case BaseActiveRecord::EVENT_BEFORE_INSERT :
            case BaseActiveRecord::EVENT_BEFORE_UPDATE :
                if (is_array($value)) {
                    $value = Json::encode($value);
                }
                break;
            case BaseActiveRecord::EVENT_AFTER_FIND :
                $value = Json::decode($value);
                break;
        }
        return $value;
    }
90372
public function serialize($value)
    {
        $this->reset();
        $serializedData = $this->serializeData($value);
        $encoded = json_encode($serializedData, $this->calculateEncodeOptions());
        if ($encoded === false || json_last_error() != JSON_ERROR_NONE) {
            if (json_last_error() != JSON_ERROR_UTF8) {
                throw new JsonSerializerException('Invalid data to encode to JSON. Error: ' . json_last_error());
            }

            $serializedData = $this->encodeNonUtf8ToUtf8($serializedData);
            $encoded = json_encode($serializedData, $this->calculateEncodeOptions());

            if ($encoded === false || json_last_error() != JSON_ERROR_NONE) {
                throw new JsonSerializerException('Invalid data to encode to JSON. Error: ' . json_last_error());
            }
        }
        return $this->processEncodedValue($encoded);
    }
1360154
public function isJson($value, $isReturnMap = false)
    {
        if (is_array($value) || is_object($value)) {
            return false;
        }
        
        $data = json_decode($value, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            return false;
        }
        
        return $isReturnMap ? $data : true;
    }
699534
private static Boolean getJsonValueAsBoolean(JsonValue value) {
        if (value != null) {
            if (value.getValueType() == ValueType.TRUE) {
                return true;
            } else if (value.getValueType() == ValueType.FALSE) {
                return false;
            }
        }
        return null;
    }
518219
public static JSONArray getArray(JSONValue value) {
        if (value == null)
            return null;
        if (!(value instanceof JSONArray))
            throw new JSONException(NOT_AN_ARRAY);
        return (JSONArray)value;
    }
484806
protected function resolveValue($value)
    {
        do {
            if ($value instanceof \JsonSerializable) {
                $value = $value->jsonSerialize();
            } elseif ($value instanceof \Closure) {
                $value = $value();
            } else {
                break;
            }
        } while (true);

        return $value;
    }
350323
public function decode($value)
    {
        $json = parent::decode($value);

        $values = json_decode($json, true);

        $this->handleJsonError('Failed to decode group values from JSON');

        return $values;
    }
107535
private function parseRawToArray(&$value, &$key)
    {
        
        // parse a json string to an array
        if (is_string($value)) {
            
            $pos = substr($value,0,1);
            if ($pos == '[' || $pos == '(' || $pos == '{') {
                $json = json_decode($value);
            } else {
                $json = $value;
            }
            

            $pos = substr($value,0,1);
            if ($pos == '[' || $pos == '(' || $pos == '{') {
                $json = json_decode($value);
            } else {
                $json = $value;
            }
            
            if ($json) {                
                $value = $json;
            }
        }

        // if the value is an object, parse it to an array
        if (is_object($value)) {
            $value = (array)$value;
        }

        // call the recursive function to all keys of array
        if (is_array($value)) {
            array_walk_recursive($value, array($this, 'parseRawToArray'));
        }
  }
322955
protected function getDataValue($value)
    {
        if (is_bool($value)) {
            return $value ? 'true' : 'false';
        } elseif (is_array($value)) {
            return Convert::array2json($value);
        } else {
            return Convert::raw2att($value);
        }
    }
71920
private function decodeJson($value)
    {
        $decodedValue = json_decode($value, true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \InvalidArgumentException('JSON parsing error: ' . json_last_error_msg());
        }

        return $decodedValue;
    }
475839
public function getData($json = true, $assoc = false)
    {
        $data = file_get_contents('php://input');
        if (!$json) {
            return $data;
        }
        return json_decode($data, $assoc);
    }
13392
public function parse($value) {
		$json = $this->decode($value);
		if (JSON_ERROR_NONE == json_last_error()) {
			return $json;
		}
		$float = filter_var($value, FILTER_VALIDATE_FLOAT);
		return $float !== false ? $float : $value;
	}
928984
private function hasValue(array $check, string $value): bool
    {
        if (empty($check[$value])) {
            return false;
        }

        return true;
    }
951022
public function setJsonValue(array $value)
    {
        $value = array_map(
            function ($value) {
                return str_replace(':', '', $value);
            },
            $value
        );
        parent::setJsonValue($value);
    }
940130
public function convert($value)
    {
        if (!is_array($value)) {
            return false;
        }

        $value = json_encode($value);
        return md5($value);
    }
635584
public function getJsonArray($json)
    {
        $response = $this->sendJsonLoad($json);
        $result = json_decode($response, true);
        if (!$result && !is_null($this->logger)) {
            $this->logger->error("json decode failed for " . substr($response, 0, 100) . " that resulted from " . substr($json, 0, 100));
        }
        return $result;
    }