How to create a URL with a list of JSON results in the middle
-
I was in the middle of writing this out as a question when I figured it out myself, so I’m sharing the solution.
Ever need to use JSON Content Importer to make a link to one url with an array of values in the middle as a list of comma separated items? For example…
https://example.com/?filter=items+in+(item1,item2,item3,)
Don’t do this…
<a href="https://example.com/?filter=items+in+([jsoncontentimporter url="https://jsonurl..." basenode="resource"]{item},[/jsoncontentimporter])">link</a>
Keeping the shortcode parameters in regular ” ” quotes inside the
<a href="">
url also wrapped in ” ” will fail. Only one set can have those. The other will need single ‘ ‘ quotes. Both of these versions below worked, so it doesn’t matter which gets single or double quotes.<a href='https://example.com/?filter=items+in+([jsoncontentimporter url="https://jsonurl..." basenode="node"]{item},[/jsoncontentimporter])'>link</a>
<a href="https://example.com/?filter=items+in+([jsoncontentimporter url='https://jsonurl...' basenode='node']{item},[/jsoncontentimporter])">link</a>
- The topic ‘How to create a URL with a list of JSON results in the middle’ is closed to new replies.