Update encoder.go
Update main_test.go
Merge pull request #1 from ngaut/master

Fix test for nil array.