Add PhpToJson and Marshal function

Add PhpToJson and Marshal function.