Im trying to create this with the php encode function:
{
"foo": [
{
"bar": "111"
}
]
}
But all i can manage with some php arrays and json encoding is this:
{
"foo": [
"{
\"bar\":184530"
}"
]
}
Obviously i don't want the object as a string but as an object, so without quotes.
Here's my PHP:
$stmt->execute();
$stmt->bind_result($bar);
while ($stmt->fetch()) {
$activity_array = array("bar" => $bar);
$activity_json = json_encode($activity_array);
$json_array[] = $activity_json;
}
$json = json_encode($json_array);
echo '{ "foo": ' .$json .'}';