##// END OF EJS Templates
Allow specifying the name of the root element of a JSON display object
Dave Hirschfeld -
Show More
@@ -800,7 +800,7 b' class JSON(DisplayObject):'
800 """
800 """
801 # wrap data in a property, which warns about passing already-serialized JSON
801 # wrap data in a property, which warns about passing already-serialized JSON
802 _data = None
802 _data = None
803 def __init__(self, data=None, url=None, filename=None, expanded=False, metadata=None, **kwargs):
803 def __init__(self, data=None, url=None, filename=None, expanded=False, metadata=None, root='root', **kwargs):
804 """Create a JSON display object given raw data.
804 """Create a JSON display object given raw data.
805
805
806 Parameters
806 Parameters
@@ -817,8 +817,13 b' class JSON(DisplayObject):'
817 Metadata to control whether a JSON display component is expanded.
817 Metadata to control whether a JSON display component is expanded.
818 metadata: dict
818 metadata: dict
819 Specify extra metadata to attach to the json display object.
819 Specify extra metadata to attach to the json display object.
820 root : str
821 The name of the root element of the JSON tree
820 """
822 """
821 self.metadata = {'expanded': expanded}
823 self.metadata = {
824 'expanded': expanded,
825 'root': root,
826 }
822 if metadata:
827 if metadata:
823 self.metadata.update(metadata)
828 self.metadata.update(metadata)
824 if kwargs:
829 if kwargs:
General Comments 0
You need to be logged in to leave comments. Login now