10.10.2 Encoding JSON

Use the haxe.Json.stringify static method to encode a Haxe value into a JSON string:

class Main {
  static function main() {
    var o = {rating: 5};
    var s = haxe.Json.stringify(o);
    trace(s); // {"rating":5}
  }
}

Take the Haxe Survey!