oslo_reports.views.json package


oslo_reports.views.json.generic module

Provides generic JSON views

This modules defines several basic views for serializing data to JSON. Submodels that have already been serialized as JSON may have their string values marked with __is_json__ = True using oslo_reports._utils.StringWithAttrs (each of the classes within this module does this automatically, and non-naive serializers check for this attribute and handle such strings specially)

class oslo_reports.views.json.generic.BasicKeyValueView

Bases: object

A Basic Key-Value JSON View

This view performs a naive serialization of a model into JSON by simply calling json.dumps() on the model

class oslo_reports.views.json.generic.KeyValueView

Bases: object

A Key-Value JSON View

This view performs advanced serialization to a model into JSON. It does so by first checking all values to see if they are marked as JSON. If so, they are deserialized using json.loads(). Then, the copy of the model with all JSON deserialized is reserialized into proper nested JSON using json.dumps().

Module contents

Provides basic JSON views

This module provides several basic views which serialize models into JSON.