I would like to maintain my form labels in Dictionary and fetch through Dictionary Service in JSS. I would like to add the labels to a dictionary folder inside the Dictionary node in Sitecore. When I do a GET call, my expectation is to get the folder structure along with keys.But in reality, the service is returning a flat structure ignoring the folder names. Is there any way to overcome it and return the folder structure?
The Sitecore dictionary API is not a hierarchical data structure; the ability to place it into folders is there for author user experience only.
If you need a hierarchical dictionary, you will need to implement your own web API to provide it, for example using Sitecore Services Client or plain ASP.NET Web API. The Sitecore C# dictionary APIs are not hierarchical, but you can use the Sitecore item API to traverse the dictionary definition item hierarchy.
Because you're not using the dictionary API memoization is not automatically handled. Ensure that you aggressively cache the dictionary data, as it will not scale well if the item hierarchy is queried every time.