datamanager: fix serialization.
util.cjson: refactor and fix code to return data in the right order.
datamanager: return data immediatly if it's not a function.
datamanager: import type().
datamanager: always append a final line break to data.