'Return serialized psuedo-JSON with translation support.
Strings are marked for extraction with r.N_. Dictionaries are
serialized to JSON objects as normal.'

@classmethod
def _make_marked_json(cls, obj):

    if isinstance(obj, dict):
        props = []
        for (key, value) in obj.iteritems():
            value_encoded = cls._make_marked_json(value)
            props.append(('%s:    %s' % (key, value_encoded)))
        return ('{%s}' % ','.join(props))
    elif isinstance(obj, basestring):
        return ('r.N_(%s)' % json.dumps(obj))
    else:
        raise ValueError, 'unsupported    type'
