I need to load a JSON file with a list of cities in one of my controllers, in order to pass it to a view afterwards.
I have placed the file here: app/assets/jsons/countriesToCities.json
(By the way: is this an appropriate location, or should I place it somewhere else?)
I have read the docs and I can see it is possible to create a JsValue from a string: https://www.playframework.com/documentation/2.4.x/ScalaJson#Using-string-parsing
I want to create a JsValue in a similar fashion. The difference is that I want to load the content from a file, not from a string... I haven't found any code snippet on how to do this, unfortunately.
Do I have to use something else to read the file into a string and only then use the parse method on that string?
Code snippets with examples on how to do this in the answers will be highly appreciated! :)
Thank you very much in advance!