Serialize and Factory for xpath and json