json-parse string expected

Q&A's, tips, howto's
Post Reply
joejoe
Posts: 169
Joined: Thu Jun 25, 2009 5:09 pm
Location: Denver, USA

json-parse string expected

Post by joejoe »

Hi,

(json-parse (exec "curl https://www.asdf.com/asdf.json"))

I am getting the message that a string is expected.

The result of the exec has [text]......[/text] at the beginning and end of what is returned.

Is this why json-parse thinks it is not a string?

I tried (json-parse (string (exec "curl....))) too. Still says a string is expected.

How do I remove the [text] ... [/text] so that the result can be interpreted by (json-parse)?

Thanks!

TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Re: json-parse string expected

Post by TedWalther »

Are you sure the link is spelled correctly? When I click the link, I get "page not found".
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.

joejoe
Posts: 169
Joined: Thu Jun 25, 2009 5:09 pm
Location: Denver, USA

Re: json-parse string expected

Post by joejoe »

Thanks again Ted,! I was able to do it with get-url here.

Code: Select all

(json-parse (get-url "https://pastebin.com/raw/brx7F2vA"))

Code: Select all

(("ID" ("1" "2" "3" "4" "5" "6" "7" "8")) ("Name" ("Rick" "Dan" "Michelle" "Ryan"             
   "Gary" "Nina" "Simon" "Guru"))                                                             
 ("Salary" ("623.3" "515.2" "611" "729" "843.25" "578" "632.8" "722.5"))                      
 ("StartDate" ("1/1/2012" "9/23/2013" "11/15/2014" "5/11/2014" "3/27/2015" "5/21/2013"        
   "7/30/2013" "6/17/2014")) 
 ("Dept" ("IT" "Operations" "IT" "HR" "Finance" "IT" "Operations" "Finance")))

Post Reply