use yajl to encode json
do valid check on every operations