finish up JSON parser + migrate some code