I've got some Json being generated from PHP but I cannot seem to get it to be the format that I need.
$metas = get_post_meta( $key, '_tribe_tickets_meta', TRUE );
foreach ( $metas as $metakey ){
$metaarray[] = array('seat_id' => $metakey);
}
}
$array1 = array(
'bookings',
array($metaarray
),
);
$jsonSave = json_encode($array1);
This gives me this output
["bookings",[[{"seat_id":"C_22"},{"seat_id":"BB_10"}]]]
What I am trying to achieve is this.
{"bookings":[{"seat_id":"C_22"}, {"seat_id":"BB_10"}]}
Thanks in advance for help, I'm entirely new to Json.