I create a string:
myOption = "{val1:'text1', val2:'text2'...}"
I need convert this string into a Object:
myOption = {val1:'text1', val2:'text2'...}
for using the jquery each function and take a pair value/text in each iteration.
Now in each iteration, it takes one char of the string.
You can use:
Keep in mind that your JSON string needs to be well-formed, and that means double-quoting property names and values:
Demo.