Add JSON support. Buf fixes.