echo '{
"Hi": 1,
"D": {
"type": "xz",
"anything": "'.$any2.'"
},
"Any": [
{
"type": "xz",
"anything": "'.$any2.'"
}
],
"Anything": [
';
if($content== $content2)
{
}
else
{
echo ' {
"type":"anything",
"block1": "'.$block2.'"
}';
}
echo ' ],
"Minus": [
"content",
"content",
],
"Block": {
"dog": "Hello-'.$hello2.'",
"cat": "",
"parrot": ""
}
}';
$data = [
'Hi' => 1,
'D' => [
'type' => 'xz',
'anything' => $any2
],
'Any' => [
[
'type' => 'xz',
'anything' => $any2
]
],
'Anything' => [],
'Minus' => [
'Content',
'Content'
],
'Block' => [
'dog' => "Hello-$hello2",
'cat' => '',
'parrot' => ''
]
];
if ($content != $content2) {
$data['Anything'][] = [
'block1' => $block2
];
}
$response = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
// $response = base64_encode($response);
echo $response;