Add a simple method for marshaling to json.

This adds a simple json dumper to the generated files.
Add MarshalJSON forwarder
Don't import JSON imports when file has no JSON writing types.
Handle TEXT_DATA and lists.

This changes the codegen so that every field get its own block with a redeclaration. Keeps the code handling names and values separate.
Don't declare encoder if not used.

If the encoder wasn't used in a function, the Go compiler would not compile the file.
Add error checking on JSON formatting
Add missing error check.
Use json.Marshal instead of encoder

Gets rid of some of the nastier pieces of logic in the compiler and doesn't put a newline on the end of each primitive value.
Merge pull request #8 from DanielMorsing/jsondump

Jsondump
Overhaul packing algorithm

This fixes 2 bugs. One where indexes were mishandled and one where
raw blocks would always be empty.

Also, gofmt
Merge pull request #10 from DanielMorsing/compressorfix

Overhaul packing algorithm