How to append a file name to .Site.Data

I want to get data from a corresponding json file by appending a file name to .Site.Data.

For example, there are json files named: A, B, C…
I use Scratch.Set "file_name" 'A' to set the filename I want to append.

I don’t want to get data using if conditionals and get data like .Site.Data.A, .Site.Data.B and .Site.Data.C, respectively, because there are many files and it will mess up the code.

I am wondering if there has any append method like .Site.Data.$file_name to get the json.

Thanks!

Try something like

index site.Data $file_name
1 Like