I have the following string that I receive from an API call:
a = "{
"option1"=>"Color",
"attribute1"=>{0=>"Black", 1=>"White",2=>"Blue"},
"option2"=>"Size",
"attribute2"=>{0=>"S", 1=>"L",2=>"M"}
}"
I would like to convert it to a JSON array; So, I have tried JSON_encode(), but it returns the following string:
""{\"option1\"=>\"Color\",\"attribute1\"=>{0=>\"Black\", 1=>\"White\",2=>\"Blue\"},\"option2\"=>\"Size\",\"attribute2\"=>{0=>\"S\", 1=>\"L\",2=>\"M\"}}""
Could you please advise me on how to achieve what i want.
Thanks