jQuery Import a JS array using ajax to pass though to a function/plugin

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

The problem seems to be that the in the working version the JQCloud plugin receives the array as objects: [object Object],[object Object] where as my ajax version receives/sends it as a string: {text:'some',weight:10},{text:'thing',weight:8}

Is there a way to import the the array and pass it though to the JQCloud function/plugin as a proper array rather than a string or convert the string to an array for processing?

It's worth noting that the return doesn't seem to be recognised as valid JSON data...

It's worth noting that the return doesn't seem to be recognised as valid JSON data...

Because it isn't ... it is a comma separated list of JSON objects. So what you need to do is: Get the string, split it at '},', add a } to each string part and JSON.parse it. Attention: This will not work if the string contains nested objects!

OK, just for referance I've recoded the original string so it's easier to split, I've then rebuilt the array once it's been imported... There must be an easier way but until I can experiment further (or someone can enlighten me); this seems to be working at the moment...
Original import string: