Example #1
0
def adrest_jsonify(content, **options):
    """ Serialize any object to JSON .

    :return str: Rendered string.

    """
    from adrest.utils.serializer import JSONSerializer
    worker = JSONSerializer(**options)
    return worker.serialize(content)
Example #2
0
    def test_json(self):
        from ...main.models import Author
        from adrest.utils.serializer import JSONSerializer

        authors = Author.objects.all()
        worker = JSONSerializer(options=dict(separators=(',', ':')))
        test = worker.serialize(authors)
        self.assertTrue("main.author" in test)
        self.assertTrue('":{"' in test)