chrisbu / dartwatch-JsonObject

JsonObject which allows dot notation access to JSON.parse'd objects. Read the article on http://www.dartlang.org/articles/json-web-service/
http://www.dartlang.org/articles/json-web-service/
MIT License
83 stars 25 forks source link

Calling toJson method on object failed #19

Closed drt24 closed 11 years ago

drt24 commented 11 years ago

In 1.0.7 my code using objectToJson works correctly but from 1.0.8 even with import 'package:json_object/src/mirror_based_serializer.dart'; I get:

Uncaught Error: Calling toJson method on object failed.
Stack Trace:
#0      _JsonStringifier.stringifyValue (dart:json:542:9)
#1      _JsonStringifier.stringifyJsonValue.<anonymous closure> (dart:json:593:23)
#2      _HashMapImpl.forEach (dart:collection:573:8)
#3      _JsonStringifier.stringifyJsonValue (dart:json:585:16)
#4      _JsonStringifier.stringifyValue (dart:json:532:29)
#5      _JsonStringifier.stringify (dart:json:471:31)
#6      stringify (dart:json:28:36)
#7      objectToJson.<anonymous closure> (package:json_object/src/mirror_based_serializer.dart:16:32)
#8      _ThenFuture._sendValue (dart:async:405:24)

The code I am running is in https://github.com/ucam-cl-dtg/nigori-dart and is the test/test.dart unit test. I tried looking at the diffs to work out where things broke but I was unsuccessful.

chrisbu commented 11 years ago

Just to confirm, have you tried the experimental "mirrors" branch?

dependencies:
  json_object:
    git:
      url: git://github.com/chrisbu/dartwatch-JsonObject.git
      ref: mirrors
drt24 commented 11 years ago

That won't work as it does not compile since

part "src/mirror_based_serializer.dart";

and yet

library json_object_mirrors;

// part of json_object;
drt24 commented 11 years ago

Fixed in #21