I have come across several web-based games (i.e. http://adarkroom.doublespeakgames.com/ or http://minmaxia.com/c2/) or i.e. Clicker Heroes on Kongregate that enable you to export a save game as something that looks like a random string of text. This can then be imported again to load the game.
I would like to program something in javascript that converts what I would normally store in localStorage:
var saveObject = {
level: 5,
xp: 3742
};
to
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb etc.
I have the feeling there is some pre-existing method or function for that, which is commonly used, but I have not yet been able to find out what it is these websites use or what it is called. If anyone has any knowledge about that (or is clever enough to dig it up from the games' code), that would be most welcome.