migrate php to js, json to xml