On Mon, 01 Sep 2014 03:29:02 GMT, David Monagle wrote:

Outputting JSON is much easier than you think:

 class MyClass : MyInterface {
   Json emit_json() {
 ...

I don't think there is any need to define the functions as properties either.

I think you highlighted the problem... I had string as the return type. Whoops. Also thanks for pointing out that I don't need property. I copied the example without understanding it.

As for you last example, is it not returning valid JSON? It's simply being escaped because you are outputting the string to the screen and it's being escaped for display purposes. Json.toString() definitely outputs a JSON string that's ready for consumption by a parser.

No, after the pass through string encoding (json->string->string), the escaping prevents it from being consumed properly in the browser and in a Ruby's json lib.