Rewrite grid to JSON