I have a JSON with an invalid space-character in it. I want to remove this space before I send it via Ajax (POST). Because of the space after "StopsCompleted" that can not be realise in PHP (empty response).
excerpt from JSON
{"Name":"StopsCompleted ","Category":"Economy","DisplayName":"Haltestellen angefahren ","DisplayDetails":"2/2","Points":10,"IsBoolean":"false",
file.php
jQuery.getJSON("/SourceFile/Vehicles", function(data){
jQuery.ajax({
url: '/SourceFile/Vehicles_ajax.php',
type: 'POST',
data: JSON.stringify(data),
processData: false,
contentType: "application/json; charset=UTF-8",
success: function(data){
jQuery('.ausgabe').html(data);
}
});
});
Vehicles-ajax.php
$jsonString = file_get_contents('php://input');
$json = json_decode($jsonString);
print_r($json);
Anyone ideas for the problem?
Thank you very much.