Reputation: 12828
Are there any tricks to get this inline json object to parse? $a[3] is a mako variable containing a url.
<li class="foldernode" yuiConfig='{"type":"TextNode","data":"{'myurl':'${a[3]}'}"}'>
Without the "type" attribute it works:
<li class="foldernode" yuiConfig='{"data":"{'myurl':'${a[3]}'}"}'>
I already had to do something hacky and use '
for single quotes which I then replace with double quotes in javascript. Any general strategies for doing this type of nested quoting would be helpful.
Upvotes: 5
Views: 3488
Reputation: 6329
A trick I usually use it to write the object in generic JavaScript, call JSON.stringify on it and copy the result. The result I got was {"type":"TextNode","data":{"myurl":"${a[3]}"}}
.
Upvotes: 2