use klass instead of literal class
explicitly call .to_s on klass before converting to json