moved merge json functionality into lib