I am currently working on developing a Gridsome application that will interact with JSON or YAML files.
My goal is to extract data from files located in the "./data/" folder within Vue components and integrate it into the GraphQL data layer. Essentially, I aim to expose data from these files through GraphQL.
profile.json
{
"name": "Lorem"
}
config.json
{
"layout": "default",
"theme": "blue"
}
I envision accessing the "name" value like this:
$page.data.profile.name
$page.data.config.theme
Alternatively,
$data.profile.name
$data.config.theme
Do I need to use @gridsome/source-filesystem and @gridsome/transformer-json plugins for this task? Or should I consider manually adding the 'Data' collection in the server and creating a new node for each file?
I have experimented with both approaches, but when exploring the GraphQL API, I encountered an error: "Unexpected token < in JSON at position 0."
Thank you!