Join Slack
Powered by
Can I read a json file located in commonTest/resou...
# multiplatform
m
mohamed rejeb
06/17/2023, 11:46 AM
Can I read a json file located in commonTest/resources in a KMP project ?
a
Adam S
06/17/2023, 11:54 AM
Yes, but the method depends on the targets you’re using. If you’re targeting JS then it will require more work. Take a look at these solutions: •
https://github.com/goncalossilva/kotlinx-resources
•
https://gist.github.com/dellisd/a1df42787d42b41cd3ce16f573984674
•
https://developer.squareup.com/blog/kotlin-multiplatform-shared-test-resources/
Or you could generate a .kt file that contains the JSON as a variable, by adapting
this answer
58
Views
Open in Slack
Previous
Next