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 receive this into a String
in java.
How I can do for deserialize this in java ?
I know the implements Serializable
in java but not work in this case.
I want to create an object in this kind of 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 another time the String
serialized from the Java object for deserialize in PHP;
Thanks for your help.