Created
March 23, 2018 17:50
-
-
Save ToJen/db252305bcf6b2eb6b0a7c36305e87e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapToJson(map) { | |
return JSON.stringify([...map]); | |
} | |
function jsonToMap(jsonStr) { | |
return new Map(JSON.parse(jsonStr)); | |
} | |
// map to JSON | |
const obj = [...enemyMap].reduce((o, [key, value]) => (o[key] = value, o), {}); | |
[...obj] | |
JSON.parse(JSON.stringify(obj[1])) // should be done in a loop | |
// JSON to map | |
// test APIs | |
curl -i -X POST -H "Content-Type: application/json" -d '{}' localhost:4000/pingland/create-level |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment