mercredi 4 mai 2022

Is there a way in Ruby to convert a inifile-like string into a json object?

Essentially, taking a string that would look something like this:

input_test = "
test1 = hello
test2 = goodbye
"

Is there a way with ruby to convert the string to be a json object?

input_test.convert_method()
puts input_test['test2'] #outputs 'goodbye'

Aucun commentaire:

Enregistrer un commentaire