added encode example

added the example for encoding a table to a json string