And I set the Root Object as “City”, I get “Brisbane” and “Sydney” as available keywords.
If I enter “City.Brisbane.things” as a JSON Data Attribute, I dont get any extra options. Same goes for “City.Brisbane.things.key1”.
Can someone please help me get all available keywords?
The addition of SSJS has really tipped the scales to the point where the JSON Data Source is more hassle than it’s worth. Pre-SSJS it provided functionality you couldn’t get any other way, but as far as I can tell any use case for those is better handled with SSJS.
<script runat="server">
var data = %globals_asset_file_contents:12345%;
Object.keys(data.City).forEach(city => print(`<p>${city}</p>`);
</script>
Either manually iterating over the data, or using a template library like Mustache, for my money this is the “correct” way to deal with JSON in Matrix and JSON Data Source should be considered defunct.
SSJS is especially good if your JSON data’s schema is not under your control, because you can work with arbitrary structures in JS that would cause problems with the JSON Data Source.
Returning to say thank you, John.
I needed to do much more complicated things with the array/objects, so I didnt use your code, but you put me into SSJS and I eventually got there.
Built it in JS and then ported it across to SSJS and changed methods where needed.