diff --git a/src/JSONArrayNode.js b/src/JSONArrayNode.js index 0f85f0c..24e0c29 100644 --- a/src/JSONArrayNode.js +++ b/src/JSONArrayNode.js @@ -25,7 +25,8 @@ function getChildNodes({ styles, theme, valueRenderer, - allExpanded + allExpanded, + keyPath }) { const childNodes = []; data.forEach((value, key) => { @@ -36,7 +37,7 @@ function getChildNodes({ const node = grabNode({ getItemString, - key, + keyPath: [key, ...keyPath], labelRenderer, previousData: previousDataValue, renderItemString, diff --git a/src/JSONIterableNode.js b/src/JSONIterableNode.js index 31611b8..d670b8b 100644 --- a/src/JSONIterableNode.js +++ b/src/JSONIterableNode.js @@ -33,7 +33,8 @@ function getChildNodes({ styles, theme, valueRenderer, - allExpanded + allExpanded, + keyPath }) { const childNodes = []; for (const entry of data) { @@ -53,7 +54,7 @@ function getChildNodes({ const node = grabNode({ getItemString, - key, + keyPath: [key, ...keyPath], labelRenderer, previousData: previousDataValue, styles, diff --git a/src/JSONNestedNode.js b/src/JSONNestedNode.js index c8fb836..479550e 100644 --- a/src/JSONNestedNode.js +++ b/src/JSONNestedNode.js @@ -98,7 +98,7 @@ export default class JSONNestedNode extends React.Component { color: this.props.theme.base0D, ...this.props.styles.getLabelStyle(this.props.nodeType, this.state.expanded) }} onClick={::this.handleClick}> - {this.props.labelRenderer(this.props.keyName)}: + {this.props.labelRenderer(...this.props.keyPath)}: - {this.props.labelRenderer(this.props.keyName)}: + {this.props.labelRenderer(...this.props.keyPath)}: