Export to GitHub

json-template - issue #8

ToString filter not doing what it should. (javascript)


Posted on Apr 7, 2009 by Happy Panda

The ToString formatter should invoke s.toString() which is either Object.toString() or whatever is overridden. Since javascript does not do this automatically like java does whenever converting an object to a string it would make sense to do this, otherwise ToString is really a noop.

Comment #1

Posted on Apr 7, 2009 by Quick Hippo

Yes, good point. The 'str' formatter is defined as "an implementation-specific string representation for the JSON node".

I added you as a member to the project. Can you provide a patch for review? See here:

http://code.google.com/p/json-template/wiki/DevelopingJsonTemplate

Thanks. This also points to the need for JavaScript-specific tests...

Comment #2

Posted on Apr 7, 2009 by Happy Panda

There are a few other issues I really want to tackle before I just go on to patch up the little problem in the JS impl (and more might become visible as I really go through all of it).

However this is a trivial fix :) Sure why not.

In javascript the standard is the .toString method, though Java casts all objects using the .toString method when converting them to a string, javascript does not do this automatically. But the Object object has it.

Comment #3

Posted on Apr 17, 2009 by Quick Hippo

Fixed in r194.

Status: Fixed

Labels:
Type-Defect Priority-Medium