If we think that, this is your associative array bellow.
$data = array(
"id_session" => "c72b0581e7675b596a7651a7bb906438",
"gibid" => "54",
"name" => "Market Place",
"type" => "S",
"num_owners" => "0",
"inner_template" => "",
"inner_data" => $databaseJson,
"outer_template" => ""
);
And bellow is the string stored in a variable named $databaseJson which is added into the associative array $data in key inner_data.
$databaseJson = '{"background":"default.jpg"}';
Now if you encode the array with json_encode() built-in function like this,
$json = json_encode($data);
echo $json;
Then you will get the output with slashes like this.
{"id_session":"c72b0581e7675b596a7651a7bb906438","gibid":"54","name":"Market Place","type":"S","num_owners":"0","inner_template":"","inner_data":"{\"background\":\"default.jpg\"}","outer_template":""}
Because $databaseJson variable is a string which is the value of $data['inner_data']. So when we are encoding the $data array, it's adding the slashes.
So, as you want to get rid of this slashes, you need to decode $databaseJson with the built-in function json_decode() to make the variable as associative array. And the array will look like this.
array("background"=>"default.jpg")
Now if we pass this array as the value of the $data array with the key inner_data, it will not create the slashes.
This is the final code bellow:
$databaseJson = '{"background":"default.jpg"}';
$databaseData = json_decode($databaseJson, true);
$data = array(
"id_session" => "c72b0581e7675b596a7651a7bb906438",
"gibid" => "54",
"name" => "Market Place",
"type" => "S",
"num_owners" => "0",
"inner_template" => "",
"inner_data" => $databaseData,
"outer_template" => ""
);
$json = json_encode($data);
echo $json;
So the output of the above code is:
{"id_session":"c72b0581e7675b596a7651a7bb906438","gibid":"54","name":"Market Place","type":"S","num_owners":"0","inner_template":"","inner_data":{"background":"default.jpg"},"outer_template":""}