convert JSON object to MySQL polygon datatype

I have the coordinates of polygon drawn in google map in JSON object. And I am able to save them in MySQL database.

But I want to save them in polygon type for further spatial processing using this code-

$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
$Latitudes   = $conn->real_escape_string($_POST['Latitudes']);
$Longitudes  = $conn->real_escape_string($_POST['Longitudes']);
$query   = "INSERT into table_name (Latitudes,Longitudes) VALUES(PolygonFromText('" . 
$Latitudes . "','" . $Longitudes . "'))";

But the error message is-Cannot get geometry object from data you send to the GEOMETRY field Or Syntax error

Please someone correct me.

Thanks!