I am trying Ralph's and am getting nil response.
If I am understanding correctly, Ralph intended that I do something like this:
Code Select
(set 'ali (get-url ali-link))
(set 'alie (json-parse ali))
(set 'jsondata (lookup "products" (lookup "result" alie)))
(define (raisins jsonitem)
(format "<a href="%s">%s</a>n"<img src="%s">nn"
(string (if (ref '("productUrl" ?) jsonitem match true) ($it 1)))
(string (if (ref '("imageTitle" ?) jsonitem match true) ($it 1)))
(string (if (ref '("imageUrl" ?) jsonitem match true) ($it 1))) ))
(println (map raisins (if (ref '("products" ?) jsondata match true) ($it 1) '())))
When I run this in my browser, I get this result:
Code Select
()
When I do
Code Select
(println (set 'jsondata (lookup "products" (lookup "result" alie))))
to see what I am working with, I get this:
Code Select
((("productTitle" "...
Notice the three leading parenthesis.
When I do this:
Code Select
(println (set 'jsonitem (jsondata 0)))
I get this:
Code Select
(("productTitle" "EMACS GNU XEMACS LISP programmer red and blue logo T-shirt Top Lycra Cotton Men T shirt New Design High Quality") ("imageUrl" "https://ae01.alicdn.com/kf/HTB1Q2qyOVXXXXa8aFXXq6xXFXXX2/EMACS-GNU-XEMACS-font-b-LISP-b-font-programmer-red-and-blue-logo-T-shirt-Top.jpg") ("productUrl" "https://www.aliexpress.com/item/EMACS-GNU-XEMACS-LISP-programmer-red-and-blue-logo-short-sleeved-T-shirt-men/2048564231.html"))
It seems the extra set of parenthesis that comes with jsondata are making it so the define cannot only get into the first set, which doesn't have the product data sets? I've tried a bunch of tweaks and am coming back to ask if I might be missing something simple.
Thank you both and all again! :0)