79640971

Date: 2025-05-27 17:53:43
Score: 2
Natty:
Report link

my approach would be to script it...

I'm gonna guess python?

def main():
    my_string = "array: ['thing1', 'thing2', 'thing3'],"
    my_string= my_string[8:-2] #remove array: [    ],
    
    split_string=my_string.split(",")
    result="objects: {\n"
    for item in split_string:
        result+="\t{\n"
        result+=f"\t\tname: {item}\n"
        result+="\t},\n"
    result+="},\n"
    print(result)

main()

result:

objects: {
        {
            name: 'thing1'
        },
        {
            name:  'thing2'
        },
        {
            name:  'thing3'
        },
},
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Hapkin