I store JSON data in HTML hidden fields on the server side. Then I'd like to retrieve that data using Javascript and JQuery on the client side. The problem is that I get a JSON string instead of a JSON object.
This is my code on the server side:
<form id="data" style="display: none;">
<input id="channels" type="hidden" tal:attributes="value python: view.context['ChannelManager'].toJSON(view.channels.values())" />
<input id="mediaGroups" type="hidden" tal:attributes="value python: view.context['MediaGroupManager'].toJSON(view.mediaGroups.values())" />
</form>
This is my code on the client side:
copy.channelList = new ChannelTest();
copy.channelList.fromJSONObjectAll($("#data input[id=channels]").val())
So I get JSON string instead of JSON object from this, $("#data input[id=channels]").val().
How could I get JSON object without converting JSON string in JSON object?
Thanks in advance!