Fixed null pointer exception in AsXElement (JSON).