ob-restclient.el
ob-restclient.el copied to clipboard
cannot remove quotes from JSON return results
Hello I am trying to remove quotes from:
{ "data": "some value but I do not need quotes" }
Using the following:
#+NAME: get-token-without-quotes
#+BEGIN_SRC restclient :results value verbatim :var uname=user_name :var pass=mypass :jq .data
POST https://api.getstuff/login
Content-Type: application/json
{
"un": ":uname",
"p": ":pass"
}
#+END_SRC
jq documentation says to use -r command line argument, however when pass -r .data , I get an error from JQ that invocation was not correct
So how do I remove quotes from get-token-without-quotes
string for subsequent invocation of another REST API call ?
thank you in advance
We currently don’t support extra arguments to jq.
I see how this can be useful, so I’ll accept a pull request for this. I might implement it myself later, but my schedule won’t allow it for now. Sorry.
Good issue, same problem here.
Try to use bash echo
command to output the string without quotes
#+name: ticket
#+BEGIN_SRC bash :var ticket_with_quote=ticket_with_quote :results value
echo $ticket_with_quote
#+END_SRC
@wisetc thank you, that works for me. it adds an extra section, so I have to add about 6 more sections, but this worked.