can now encode to json