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

toString issue #4

Closed freewind closed 12 years ago

freewind commented 12 years ago
class User extends JsonObject {
    String name;
}

var user = new User();
user.name = "Mike";
print(user.toString());

Will print null.

I think it should always use JSON.stringify instead of _jsonString.

chrisbu commented 12 years ago

I've changed the toString functionality to use JSON.stringify, and added a unit test, but the code above is slightly wrong.
The name property on the User class is a "real" property, and won't be intercepted by JsonObject's noSuchMethod call, which, which is why it prints null.