Fixes faulty serialize function

It was not a valid JSON object and it converts arrays into objects
Updated documentation
Updated dist JS