Convert JSON to PHP array.
971217
protected static function convert($string, $path)
    {
        $data = json_decode($string, true);
        //
        if (json_last_error() == JSON_ERROR_SYNTAX) {
            throw new InfoStructureException($path);
        }
        //
        return $data;
    }
497780
public function jsonSerialize()
    {
        $arr = parent::jsonSerialize();
        $vars = get_object_vars($this);
        return array_merge($vars, $arr);
    }
218495
def _convert_dict_to_json(array):
    
    return json.dumps(
        array,
        skipkeys=False,
        allow_nan=False,
        indent=None,
        separators=(",", ":"),
        sort_keys=True,
        default=lambda o: o.__dict__,
    )
688064
public function jsonSerialize(): array
    {
        $outObj         = array();
        $outObj['name'] = $this->name;
        if ($this->type !== null) {
            $outObj['type'] = $this->type;
        }
        if ($this->dynamic !== null) {
            $outObj['dynamic'] = $this->dynamic;
        }
        if ($this->docs !== null) {
            $outObj['docs'] = $this->docs;
        }
        return $outObj;
    }
996608
function jsonSerialize(): \stdClass {
    return (object) [
      'lineNumber' => $this->getLineNumber(),
      'blockNumber' => $this->getBlockNumber(),
      'branchNumber' => $this->getBranchNumber(),
      'taken' => $this->getTaken()
    ];
  }
1098724
def from_json(cls, string):
        """"""
        obj = json.loads(string)
        return cls(obj['regexp'], obj['files'])
960311
def to_json(self, value):
        """"""
        if not self.is_valid(value):
            raise ex.SerializeException('Invalid value: {}'.format(value))
        return value
575020
function jsonSerialize()
    {
        $result = [
            'text' => $this->text
        ];

        if ($this->requestContact !== null) {
            $result['request_contact'] = $this->requestContact;
        }

        if ($this->requestLocation !== null) {
            $result['request_location'] = $this->requestLocation;
        }

        return $result;
    }
1147553
function jsonSerialize()
    {
        $data = [
            'text' => $this->text
        ];

        if ($this->replyMarkup) {
            $data['reply_markup'] = $this->replyMarkup;
        }

        return $data;
    }
478120
public function jsonSerialize(): array
    {
        $returnArray = [];
        foreach ($this->getArrayCopy() as $value) {
            $returnArray[] = $value->JsonSerialize();
        }
        return $returnArray;
    }
482305
def json_dumps(o):
    """"""
    return json.dumps(o, indent=4, sort_keys=True, ensure_ascii=True,
                      separators=(',', ': ')).encode('ascii')
829317
public function toJson() {
		$result = array();
		$value = $this->getValue();

		if ($value instanceof MoufInstanceDescriptor) {
			$serializableValue = $value->getIdentifierName();
			//$result['type'] = 'object';
		} elseif (is_array($value)) {
			// We cannot match a PHP array to a JSON array!
			// The keys in a PHP array are ordered. The key in a JSON array are not ordered!
			// Therefore, we will be sending the arrays as JSON arrays of key/values to preserve order.
			$serializableValue = self::arrayToJson($value);
			
			//$result['type'] = 'scalar';
			// Let's find the type:
			/*foreach ($value as $val) {
				if ($val instanceof MoufInstanceDescriptor) {
					//$result['type'] = 'object';
					break;
				}
			}*/
			
		} else {
			$serializableValue = $value;
			//$result['type'] = 'scalar';
		}
		
		try {
			$type = $this->propertyDescriptor->getTypes()->getCompatibleTypeForInstance($value);
		} catch (\ReflectionException $e) {
			// If an error occurs here, let's silently continue with an error message added.
			$result['warning'] = $e->getMessage();
			$type = null;
		}
		/*if ($type == null) {
			throw new MoufException("Error for property ".$this->propertyDescriptor->getName()." for instance ".$this->instanceDescriptor->getName().".");
		}*/
		if ($type == null) {
			$result['type'] = null;
		} else {
			$result['type'] = $type->toJson();
		}
		$result['value'] = $serializableValue;
		$result['isset'] = $this->isValueSet();
		$result['origin'] = $this->getOrigin();
		$result['metadata'] = $this->getMetaData();
		return $result;
	}
1269196
def _parse_json(s):
    '''
    
    '''
    return json.loads(s, object_hook=lambda pairs: JsonDict(pairs.iteritems()))
1176733
def json(body, charset='utf-8', **kwargs):
    """"""
    return json_converter.loads(text(body, charset=charset))
1240854
def json(content, request=None, response=None, ensure_ascii=False, **kwargs):
    """"""
    if hasattr(content, 'read'):
        return content

    if isinstance(content, tuple) and getattr(content, '_fields', None):
        content = {field: getattr(content, field) for field in content._fields}
    return json_converter.dumps(content, default=_json_converter, ensure_ascii=ensure_ascii, **kwargs).encode('utf8')
1185196
public function toJson() {
		$array = array("types"=>array());
		foreach ($this->types as $type) {
			$array["types"][] = $type->toJson();
		}
		if ($this->warningMessage) {
			$array["warning"] = $this->warningMessage;
		}
		return $array;
	}
288522
private function simple_json_parser($json){
        $json = str_replace("{","",str_replace("}","", $json));
        $jsonValue = explode(",", $json);
        $arr = array();
        foreach($jsonValue as $v){
            $jValue = explode(":", $v);
            $arr[str_replace('"',"", $jValue[0])] = (str_replace('"', "", $jValue[1]));
        }
        return $arr;
    }