Kotlin DSL reading JSON file
I am looking to read in a file as part of the Kotlin DSL definition of my TC pipeline - i.e. read in JSON and build a parameter of tick boxes depending on the file contents. However, I am having trouble reading the file into the Kotlin code. I am behind a number of firewalls so I cant easily pull import libraries from outside my org. Is this possible? How do I do file handling? Do I need to import any specific libraries? Is there a JSON handler?
When trying to access the file using
var modulesJson = File("../module_def.json").bufferedReader()
I get:
Unresolved reference: File
I see the file needs to be in the .teamcity folder, which is not an issue.
Any help would be appreciated.
Please sign in to leave a comment.
Hello Steven,
It should be possible to do it. It seems that you are missing the import java.io.File.
Can you try it and let us know if it works for you?
Thank you,
Guilherme