stringer.key(id.toString()).object();
for (Entry<Procedure, MarkovGraph> e : this.markovs.get(id).entrySet()) {
// Optimization: Hex-encode all of the MarkovGraphs so that we don't get crushed
// when trying to read them all back at once when we create the JSONObject
try {
FastSerializer fs = new FastSerializer(false, false); // C++ needs little-endian
fs.write(e.getValue().toJSONString().getBytes());
String hexString = fs.getHexEncodedBytes();
stringer.key(CatalogKey.createKey(e.getKey())).value(hexString);
} catch (Exception ex) {
String msg = String.format("Failed to serialize %s MarkovGraph for Id %d", e.getKey(), id);
LOG.fatal(msg);
throw new JSONException(ex);