// The script converts the JSON string into an object, sets the attribute 'firstName' to 'Horst'
// and converts the object back to JSON string
InputStream convertedJson = execPHP("$person = json_decode($_ARGV[0]);$person->firstName = 'Horst'; fwrite(STDOUT, json_encode($person));", json);
// Read JSON from PHP back into person
Person horst = (Person) trans.deserializeFromJson(convertedJson, Person.class);
convertedJson.close();
// Check the result.
if ("Horst".equals(horst.getFirstName())) {
System.out.println("Horst OK");