PHP Mysql Json tag cleaning

I have data something like that https://prnt.sc/1b21psb I'm inserting that data with python to mysql and showing on panel with PHP how can I clean those tags?
Depends on how have the tags. You have it inside an array that you are putting through json_encode? If so, try the json_encode like this:

Code:
echo json_encode($data, JSON_PRETTY_PRINT);

If you have raw json that you are echoing, try:

Code:
echo json_encode(json_decode($data, true), JSON_PRETTY_PRINT);

Untested code. If you get error, please reply with the message.
 
Last edited:
Depends on how have the tags. You have it inside an array that you are putting through json_encode? If so, try the json_encode like this:

Code:
echo json_encode($data, JSON_PRETTY_PRINT);

If you have raw json that you are echoing, try:

Code:
echo json_encode(json_decoe($data, true), JSON_PRETTY_PRINT);

Untested code. If you get error, please reply with the message.
Nothing is changed https://prnt.sc/1b27tre but I wrote a small function for cleaning tags. Next time I have to go deeper thanks for your effort :)
PHP:
function tagcleaner($data)
{
    $data = str_replace("[[", "", $data);
    $data = str_replace("[", "", $data);
    $data = str_replace("]]", "", $data);
    $data = str_replace('""', "", $data);
    $data = str_replace('"', "", $data);
    return $data;
}
 
Back
Top