Replies: 2 comments 2 replies
-
CodeWars does not currently support including external libraries or dependencies in Elixir kata. This is due to security concerns, as allowing arbitrary code execution can open up potential vulnerabilities. However, there are ways to work with JSON in Elixir without the need for external libraries. Elixir provides a built-in module called Jason for working with JSON. This module is part of Elixir's standard library and does not require any additional setup or installation. To use the Jason module, you can simply include it in your Elixir code by adding the following line at the top of your file: "require Jason" You can then use the functions provided by the Jason module to parse and generate JSON data. Here's an example of how you can use the Jason module to parse a JSON string: "json_string = "{"name": "John", "age": 30}" In this example, we're using the decode!/1 function provided by the Jason module to parse the JSON string into an Elixir map. The ! at the end of the function name indicates that it will raise an error if the JSON string is not valid. |
Beta Was this translation helpful? Give feedback.
-
Additional libraries can be requested by using an appropriate issue template in codewars/runner repository. Please create a package request there by filling the template with all necessary details. |
Beta Was this translation helpful? Give feedback.
-
JSON manipulation is a big part of backend/API coding, and I'm not seeing any Elixir kata that deal with this. Even trying to create some, I can't find a way to include the JSON module in the code. Does CodeWars have a way to include libraries that would normally be included via the
mix
utility?I don't understand the underlying mechanics of how elixir is safely compiled/run within CodeWars. I understand this may create security concerns, but it seems like there are several libraries (like JSON) which could be preloaded and available for import.
Perhaps this is already the case, but I don't have the syntax right. If so, I'd appreciate some guidance there, too. I did my best to google and search through other kata to find my answer before asking here.
Beta Was this translation helpful? Give feedback.
All reactions