Serialize PHP => Unserialize JAVA / Serialize for php in string format
I have an array in php of this format:
<?php
$value = array("id" => 42, "user" => "superman");
echo serialize($value);
?>
Serialized:
a:2:{s:2:"id";i:42;s:4:"user";s:8:"superman";}
I get this in Stringin java. How can I do this for deserialization in java? I know implements Serializablein java, but not working in this case.
I want to create an object in this format:
import java.io.Serializable;
public class Serial implements Serializable{
private int mId;
private String mUser;
public Serial(int mId, String mUser) {
super();
this.mId = mId;
this.mUser = mUser;
}
public int getId() {
return mId;
}
public void setId(int id) {
this.mId = id;
}
public String getUser() {
return mUser;
}
public void setUser(String user) {
this.mUser = user;
}
}
After that, I want to create one more time String, serialized from a Java object for deserialization in PHP;
Thank you for your help.