function Message::parseFromJsonStream
@ignore
1 call to Message::parseFromJsonStream()
- Message::mergeFromJsonString in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php - Parses a json string to protobuf message.
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 1300
Class
- Message
- Parent class of all proto messages. Users should not instantiate this class or extend this class or its child classes by their own. See the comment of specific functions for more details.
Namespace
Google\Protobuf\InternalCode
public function parseFromJsonStream($input, $ignore_unknown) {
$array = json_decode($input->getData(), true, 512, JSON_BIGINT_AS_STRING);
if ($this instanceof \Google\Protobuf\ListValue) {
$array = [
"values" => $array,
];
}
if (is_null($array)) {
if ($this instanceof \Google\Protobuf\Value) {
$this->setNullValue(\Google\Protobuf\NullValue::NULL_VALUE);
return;
}
else {
throw new GPBDecodeException("Cannot decode json string: " . $input->getData());
}
}
try {
$this->mergeFromJsonArray($array, $ignore_unknown);
} catch (\Exception $e) {
throw new GPBDecodeException($e->getMessage(), $e->getCode(), $e);
}
}