cool. I like the jsoneditoronline.org
web site, going to use that next time I need to share some JSON
I was able to locate your numRefinements
value in both env’s using
object.contents.find(c => c[`@type`] === `BananaPage`)
.mainNavigation.find(m => m[`@type`] === `ContentSlotSecondary`)
.contents.find(c => c[`@type`] === `ContentSlotSecondary`)
.contents.find(c => c[`@type`] === `GuidedNavigation`)
.navigation.find(n => n.dimensionName === `Brand`)
.numRefinements
I did notice that the path to "dimensionName" : "Brand"
for env1 is
objectâ–şcontentsâ–ş0â–şmainNavigationâ–ş1â–şcontentsâ–ş0â–şcontentsâ–ş0â–şnavigationâ–ş0â–şdimensionName
which isn’t the same path as you gave, but there was only one key/value pair like that so went with that instead.
I do assume that the value for @type
is a good unique identifier to use to find the item in the contents
and mainNavigation
arrays. If it isn’t, you may want to select by another field.
Lastly, I was able to refine the command using the Chrome Dev Tools.
I created two variables
const env1 = <<...paste env1 JSON...>>
const env2 = <<...paste env2 JSON...>>
Then, as you build up the command, Chrome shows you the results in grey as you go
You can flick between env1 & env2 results by changing the first variable, a handy way to confirm the command works for both env’s.